code: def extract_key_value(line, environ):
      
      segments = line.split("=", 1)
      if len(segments) < 2:
          return None
      key, value = segments
      # foo passes through as-is (with spaces stripped)
      # '{foo}' passes through literally
      # "{foo}" substitutes from environ's foo
      value = value.strip()
      if value[0] == "'" and _SQUOTE_RE.match(value):
          value = value[1:-1]
      elif value[0] == '"' and _DQUOTE_RE.match(value):
          template = value[1:-1]
          value = template.format(**environ)
      key = key.strip()
      value = value.strip()
      return key, value
docs: Return key, value from given line if present, else return None.