docs: def parse_line(p_string):
      """
      Parses a single line as can be encountered in a todo.txt file.
      First checks whether the standard elements are present, such as priority,
      creation date, completeness check and the completion date.
  
      Then the rest of the analyzed for any occurrences of contexts, projects or
      tags.
  
      Returns an dictionary with the default values as shown below.
      """
      result = {
          'completed': False,
          'completionDate': None,
          'priority': None,
          'creationDate': None,
          'text': "",
          'projects': [],
          'contexts': [],
          'tags': {},
      }
  
      completed_head = _COMPLETED_HEAD_MATCH.match(p_string)
      normal_head = _NORMAL_HEAD_MATCH.match(p_string)
  
      rest = p_string
  
      if completed_head:
          result['completed'] = True
  
          completion_date = completed_head.group('completionDate')
          try:
              result['completionDate'] = date_string_to_date(completion_date)
          except ValueError:
              pass
  
          creation_date = completed_head.group('creationDate')
  
          try:
              result['creationDate'] = date_string_to_date(creation_date)
          except ValueError:
              pass
  
          rest = completed_head.group('rest')
      elif normal_head:
          result['priority'] = normal_head.group('priority')
  
          creation_date = normal_head.group('creationDate')
  
          try:
              result['creationDate'] = date_string_to_date(creation_date)
          except ValueError:
              pass
  
          rest = normal_head.group('rest')
  
      for word in rest.split():
          project = _PROJECT_MATCH.match(word)
          if project:
              result['projects'].append(project.group(1))
  
          context = _CONTEXT_MATCH.match(word)
          if context:
              result['contexts'].append(context.group(1))
  
          tag = _TAG_MATCH.match(word)
          if tag:
              tag_name = tag.group('tag')
              tag_value = tag.group('value')
              try:
                  result['tags'][tag_name].append(tag_value)
              except KeyError:
                  result['tags'][tag_name] = [tag_value]
          else:
              result['text'] += word + ' '
  
      # strip trailing space from resulting text
      result['text'] = result['text'][:-1]
  
      return result