





"""simple docstring"""




def 						UpperCAmelCase__		(     _UpperCAmelCase					):






  """simple docstring"""





  if bit_count < 0:
    raise ValueError('The given input must be positive'					)

  # get the generated string sequence
  A_  :       List[str]										=  gray_code_sequence_string(__UpperCamelCase					)
  #
  # convert them to integers
  for i in range(len(__UpperCamelCase					)					):
    A_  :       Any										=  int(sequence[i] ,					2					)

  return sequence





def 						UpperCAmelCase__		(     _UpperCAmelCase					):






  """simple docstring"""





  if bit_count == 0:
    return ["0"]

  if bit_count == 1:
    return ["0", "1"]

  A_  :       Optional[int]										=  1 << bit_count  # defines the length of the sequence
  # 1<< n is equivalent to 2^n

  # recursive answer will generate answer for n-1 bits
  A_  :       Optional[int]										=  gray_code_sequence_string(bit_count - 1					)

  A_  :       Union[str, Any]										=  []

  # append 0 to first half of the smaller sequence generated
  for i in range(seq_len // 2					):
    A_  :       Union[str, Any]										=  '0' + smaller_sequence[i]
    sequence.append(__UpperCamelCase					)

  # append 1 to second half ... start from the end of the list
  for i in reversed(range(seq_len // 2					)					):
    A_  :       int										=  '1' + smaller_sequence[i]
    sequence.append(__UpperCamelCase					)

  return sequence


if __name__ == "__main__":
   import doctest

   doctest.testmod()
from datetime import datetime

import requests
from bsa import BeautifulSoup

if __name__ == "__main__":
   __lowerCamelCase			: str							   =		input('''Enter image url: ''').strip()
   print(F"""Downloading image from {url} ...""")
   __lowerCamelCase			: Any							   =		BeautifulSoup(requests.get(url).content, '''html.parser''')
   # The image URL is in the content field of the first meta tag with property og:image
   __lowerCamelCase			: List[Any]							   =		soup.find('''meta''', {'''property''': '''og:image'''})['''content''']
   __lowerCamelCase			: Tuple							   =		requests.get(image_url).content
   __lowerCamelCase			: Union[str, Any]							   =		F"""{datetime.now():%Y-%m-%d_%H:%M:%S}.jpg"""
   with open(file_name, '''wb''') as fp:
      fp.write(image_data)
   print(F"""Done. Image saved to disk as {file_name}.""")
