
import importlib.metadata
import subprocess
import sys

def a__   (	A_ = False ):






  '''simple docstring'''





  __magic_name__    					=	False
  if "IPython" in sys.modules:
    __magic_name__    					=	"""google.colab""" in str(sys.modules["""IPython"""].get_ipython() )

  if in_colab:
    if upgrade:
      __magic_name__    					=	["""pip""", """install""", """-U""", """torch"""]
      subprocess.run(A_,					check=A_ )
    # get the current version of torch
    __magic_name__    					=	importlib.metadata.version("""torch""" )
    __magic_name__    					=	torch_version[: torch_version.rindex(""".""" )]
    __magic_name__    					=	f'''https://storage.googleapis.com/tpu-pytorch/wheels/colab/torch_xla-{torch_version_trunc}-cp37-cp37m-linux_x86_64.whl'''
    __magic_name__    					=	["""pip""", """install""", xla_wheel]
    subprocess.run(A_,					check=A_ )
  else:
    raise RuntimeError("""`install_xla` utility works only on google colab.""" )



def a__   (	A_ ):






  '''simple docstring'''





  __magic_name__    					=	str(A_ ).strip()
  if not bin_string:
    raise ValueError("""Empty string was passed to the function""" )
  __magic_name__    					=	bin_string[0] == """-"""
  if is_negative:
    __magic_name__    					=	bin_string[1:]
  if not all(char in """01""" for char in bin_string ):
    raise ValueError("""Non-binary value was passed to the function""" )
  __magic_name__    					=	0
  for char in bin_string:
    __magic_name__    					=	2 * decimal_number + int(A_ )
  return -decimal_number if is_negative else decimal_number


if __name__ == "__main__":
    from doctest import testmod

    testmod()

