code: def extract_headers(headers):
      
      sorted_headers = {}
      matches = re.findall(r'(.*):\s(.*)', headers)
      for match in matches:
          header = match[0]
          value = match[1]
          try:
              if value[-1] == ',':
                  value = value[:-1]
              sorted_headers[header] = value
          except IndexError:
              pass
      return sorted_headers
docs: This function extracts valid headers from interactive input.