docs: def query_edges(self,
                      bel: Optional[str] = None,
                      source_function: Optional[str] = None,
                      source: Union[None, str, Node] = None,
                      target_function: Optional[str] = None,
                      target: Union[None, str, Node] = None,
                      relation: Optional[str] = None,
                      ):
          """Return a query over the edges in the database.
  
          Usually this means that you should call ``list()`` or ``.all()`` on this result.
  
          :param bel: BEL statement that represents the desired edge.
          :param source_function: Filter source nodes with the given BEL function
          :param source: BEL term of source node e.g. ``p(HGNC:APP)`` or :class:`Node` object.
          :param target_function: Filter target nodes with the given BEL function
          :param target: BEL term of target node e.g. ``p(HGNC:APP)`` or :class:`Node` object.
          :param relation: The relation that should be present between source and target node.
          """
          if bel:
              return self.search_edges_with_bel(bel)
  
          query = self.session.query(Edge)
  
          if relation:
              query = query.filter(Edge.relation.like(relation))
  
          if source_function:
              query = self._add_edge_function_filter(query, Edge.source_id, source_function)
  
          if target_function:
              query = self._add_edge_function_filter(query, Edge.target_id, target_function)
  
          if source:
              if isinstance(source, str):
                  source = self.query_nodes(bel=source)
                  if source.count() == 0:
                      return []
                  source = source.first()  # FIXME what if this matches multiple?
                  query = query.filter(Edge.source == source)
              elif isinstance(source, Node):
                  query = query.filter(Edge.source == source)
              else:
                  raise TypeError('Invalid type of {}: {}'.format(source, source.__class__.__name__))
  
          if target:
              if isinstance(target, str):
                  targets = self.query_nodes(bel=target).all()
                  target = targets[0]  # FIXME what if this matches multiple?
                  query = query.filter(Edge.target == target)
              elif isinstance(target, Node):
                  query = query.filter(Edge.target == target)
              else:
                  raise TypeError('Invalid type of {}: {}'.format(target, target.__class__.__name__))
  
          return query