





from datetime import date

import requests

UpperCAmelCase			:			List[str]	  = """https://api.carbonintensity.org.uk/intensity"""
def   _A (	):





  """simple docstring"""



  a__			:      List[str]            =requests.get(SCREAMING_SNAKE_CASE		).json()["data"][0]
  return last_half_hour["intensity"]["actual"]
def   _A (	SCREAMING_SNAKE_CASE  :     Any , SCREAMING_SNAKE_CASE  :     Dict		):





  """simple docstring"""



  return requests.get(f'''{BASE_URL}/{start}/{end}'''		).json()["data"]


if __name__ == "__main__":
     for entry in fetch_from_to(start=date(2020, 10, 1), end=date(2020, 10, 3)):
          print("""from {from} to {to}: {intensity[actual]}""".format(**entry))
     print(F"""{fetch_last_half_hour() = }""")













def   _A (	SCREAMING_SNAKE_CASE  :     int		):





  """simple docstring"""



  if not isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE		) or number < 0:
    raise ValueError("Input must be a non-negative integer"		)

  a__			:      List[str]            =number & ~(number - 1)
  a__			:      Optional[int]            =0
  while intermediate:
    intermediate >>= 1
    index += 1
  return index - 1


if __name__ == "__main__":
     import doctest

     doctest.testmod(verbose=True)






