

from json import JSONDecodeError  # Workaround for requests.exceptions.JSONDecodeError

import requests






def    a__   (   __SCREAMING_SNAKE_CASE = "isbn/0140328726"			)     ->     dict:
		__lowerCAmelCase:	Dict   				=      olid.strip().strip("/"			)  # Remove leading/trailing whitespace & slashes
		if new_olid.count("/"			) != 1:
				__lowerCAmelCase:	int   				=      F"{olid} is not a valid Open Library olid"
				raise ValueError(__SCREAMING_SNAKE_CASE			)
		return requests.get(F"https://openlibrary.org/{new_olid}.json"			).json()






def    a__   (   __SCREAMING_SNAKE_CASE			)     ->     dict:
		__lowerCAmelCase:	Optional[int]   				=      {
		    "title": "Title",
		    "publish_date": "Publish date",
		    "authors": "Authors",
		    "number_of_pages": "Number of pages:",
		    "first_sentence": "First sentence",
		    "isbn_10": "ISBN (10)",
		    "isbn_13": "ISBN (13)",
		}
		__lowerCAmelCase:	str   				=      {better_key: ol_book_data[key] for key, better_key in desired_keys.items()}
		__lowerCAmelCase:	Dict   				=      [
		    get_openlibrary_data(author["key"]			)["name"] for author in data["Authors"]
		]
		__lowerCAmelCase:	Optional[int]   				=      data["First sentence"]["value"]
		for key, value in data.items():
				if isinstance(__SCREAMING_SNAKE_CASE ,			__SCREAMING_SNAKE_CASE			):
						__lowerCAmelCase:	int   				=      ", ".join(__SCREAMING_SNAKE_CASE			)
		return data


if __name__ == "__main__":
			import doctest

			doctest.testmod()

			while True:
						__A						       =      input("\nEnter the ISBN code to search (or 'quit' to stop): ").strip()
						if isbn.lower() in ("", "q", "quit", "exit", "stop"):
									break

						if len(isbn) not in (10, 13) or not isbn.isdigit():
									print(F'''Sorry, {isbn} is not a valid ISBN.  Please, input a valid ISBN.''')
									continue

						print(F'''\nSearching Open Library for ISBN: {isbn}...\n''')

						try:
									__A						       =      summarize_book(get_openlibrary_data(F'''isbn/{isbn}'''))
									print("\n".join(F'''{key}: {value}''' for key, value in book_summary.items()))
						except JSONDecodeError:  # Workaround for requests.exceptions.RequestException:
									print(F'''Sorry, there are no results for ISBN: {isbn}.''')





"""simple docstring"""


def    a__   (   __SCREAMING_SNAKE_CASE ,			__SCREAMING_SNAKE_CASE			)     ->     int:
		return int((input_a, input_a).count(0			) == 0			)






def    a__   (   )     ->     None:
		assert and_gate(0 ,			0			) == 0
		assert and_gate(0 ,			1			) == 0
		assert and_gate(1 ,			0			) == 0
		assert and_gate(1 ,			1			) == 1


if __name__ == "__main__":
			test_and_gate()
			print(and_gate(1, 0))
			print(and_gate(0, 0))
			print(and_gate(0, 1))
			print(and_gate(1, 1))


