text: state_to_code_dict = {
      "alabama": "AL",
      "alaska": "AK",
      "arizona": "AZ",
      "arkansas": "AR",
      "california": "CA",
      "colorado": "CO",
      "connecticut": "CT",
      "delaware": "DE",
      "district of columbia": "DC",
      "florida": "FL",
      "georgia": "GA",
      "hawaii": "HI",
      "idaho": "ID",
      "illinois": "IL",
      "indiana": "IN",
      "iowa": "IA",
      "kansas": "KS",
      "kentucky": "KY",
      "louisiana": "LA",
      "maine": "ME",
      "maryland": "MD",
      "massachusetts": "MA",
      "michigan": "MI",
      "minnesota": "MN",
      "mississippi": "MS",
      "missouri": "MO",
      "montana": "MT",
      "nebraska": "NE",
      "nevada": "NV",
      "new hampshire": "NH",
      "new jersey": "NJ",
      "new mexico": "NM",
      "new york": "NY",
      "north carolina": "NC",
      "north dakota": "ND",
      "ohio": "OH",
      "oklahoma": "OK",
      "oregon": "OR",
      "pennsylvania": "PA",
      "rhode island": "RI",
      "south carolina": "SC",
      "south dakota": "SD",
      "tennessee": "TN",
      "texas": "TX",
      "utah": "UT",
      "vermont": "VT",
      "virginia": "VA",
      "washington": "WA",
      "west virginia": "WV",
      "wisconsin": "WI",
      "wyoming": "WY",
      "american samoa": "AS",
      "guam": "GU",
      "northern mariana islands": "MP",
      "puerto rico": "PR",
      "u.s. virgin islands": "VI",
      "u.s. minor outlying islands": "UM",
      "micronesia": "FM",
      "marshall islands": "MH",
      "palau": "PW",
  }
  
  code_to_state_dict = {v: k for k, v in state_to_code_dict.items()}
  
  
  def state_code_from_name(name):
      if name:  # can't run lower() on None
          return state_to_code_dict.get(name.lower(), None)
      return None
  
  
  def state_name_from_code(code):
      retval = code_to_state_dict.get(code, None)
      if retval:
          return retval.title()
      return retval
  