docs: def add_dependency(self, p_from_todo, p_to_todo):
          """ Adds a dependency from task 1 to task 2. """
          def find_next_id():
              """
              Find a new unused ID.
              Unused means that no task has it as an 'id' value or as a 'p'
              value.
              """
              def id_exists(p_id):
                  """
                  Returns True if there exists a todo with the given parent ID.
                  """
                  for todo in self._todos:
                      number = str(p_id)
                      if todo.has_tag('id', number) or todo.has_tag('p', number):
                          return True
  
                  return False
  
              new_id = 1
              while id_exists(new_id):
                  new_id += 1
  
              return str(new_id)
  
          def append_projects_to_subtodo():
              """
              Appends projects in the parent todo item that are not present in
              the sub todo item.
              """
              if config().append_parent_projects():
                  for project in p_from_todo.projects() - p_to_todo.projects():
                      self.append(p_to_todo, "+{}".format(project))
  
          def append_contexts_to_subtodo():
              """
              Appends contexts in the parent todo item that are not present in
              the sub todo item.
              """
              if config().append_parent_contexts():
                  for context in p_from_todo.contexts() - p_to_todo.contexts():
                      self.append(p_to_todo, "@{}".format(context))
  
          if p_from_todo != p_to_todo and not self._depgraph.has_edge(
                  hash(p_from_todo), hash(p_to_todo)):
  
              dep_id = None
              if p_from_todo.has_tag('id'):
                  dep_id = p_from_todo.tag_value('id')
              else:
                  dep_id = find_next_id()
                  p_from_todo.set_tag('id', dep_id)
  
              p_to_todo.add_tag('p', dep_id)
              self._add_edge(p_from_todo, p_to_todo, dep_id)
              append_projects_to_subtodo()
              append_contexts_to_subtodo()
              self.dirty = True