code: 
  
  
  
  from datetime import date
  
  import requests
  
  lowerCAmelCase__	:  Any 		='''https://api.carbonintensity.org.uk/intensity'''
  
  
  
  
  
  
  def 			__lowercase     (				)       ->				str:
  							__SCREAMING_SNAKE_CASE								=      requests.get(UpperCAmelCase_     ).json()['''data'''][0]
  							return last_half_hour["intensity"]["actual"]
  
  
  
  
  
  
  def 			__lowercase     (				a__							,     a__     )       ->				list:
  							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() = }''')
style_context: 
  
  
  
  def 			__lowercase     (				a__     )       ->				int:
  							return int(a__     ) if x - int(a__     ) <= 0 else int(a__     ) + 1
  
  
  if __name__ == "__main__":
  			import doctest
  
  			doctest.testmod()
  
  
  
  
  
  
  