code: def _parseline(line):
      
      match = re.match(r"^\s*(export)?\s*(\S+)=(?:(?:"
                       r"(?:\"(.*[^\\])\")|(?:'(.*[^\\])')|"
                       r"(?:([^\"'#\s]+)))?)\s*#*", line)
      if not match:
          LOGGER.warning("Invalid line found: %s", line)
          return (None, None)
  
      tpl = match.groups()
      vals = list(itertools.dropwhile(lambda x: x is None, tpl[2:]))
      return (tpl[1], vals[0] if vals else '')
docs: Parse a line contains shell variable definition.
  
      :param line: A string to parse, must not start with '#' (comment)
      :return: A tuple of (key, value), both key and value may be None
  
      >>> _parseline("aaa=")
      ('aaa', '')
      >>> _parseline("aaa=bbb")
      ('aaa', 'bbb')
      >>> _parseline("aaa='bb b'")
      ('aaa', 'bb b')
      >>> _parseline('aaa="bb#b"')
      ('aaa', 'bb#b')
      >>> _parseline('aaa="bb\\"b"')
      ('aaa', 'bb"b')
      >>> _parseline("aaa=bbb   # ccc")
      ('aaa', 'bbb')