def vectors(self, direction="all", failed=False):
        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))
        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()