code: def vectors(self, direction="all", failed=False):
          
          # check direction
          if direction not in ["all", "incoming", "outgoing"]:
              raise ValueError(
                  "{} is not a valid vector direction. "
                  "Must be all, incoming or outgoing.".format(direction))
  
          if failed not in ["all", False, True]:
              raise ValueError("{} is not a valid vector failed".format(failed))
  
          # get the vectors
          if failed == "all":
              if direction == "all":
                  return Vector.query\
                      .filter(or_(Vector.destination_id == self.id,
                                  Vector.origin_id == self.id))\
                      .all()
  
              if direction == "incoming":
                  return Vector.query\
                      .filter_by(destination_id=self.id)\
                      .all()
  
              if direction == "outgoing":
                  return Vector.query\
                      .filter_by(origin_id=self.id)\
                      .all()
          else:
              if direction == "all":
                  return Vector.query\
                      .filter(and_(Vector.failed == failed,
                              or_(Vector.destination_id == self.id,
                                  Vector.origin_id == self.id)))\
                      .all()
  
              if direction == "incoming":
                  return Vector.query\
                      .filter_by(destination_id=self.id, failed=failed)\
                      .all()
  
              if direction == "outgoing":
                  return Vector.query\
                      .filter_by(origin_id=self.id, failed=failed)\
                      .all()
docs: Get vectors that connect at this node.
  
          Direction can be "incoming", "outgoing" or "all" (default).
          Failed can be True, False or all