docs: def is_connected(self, whom, direction="to", failed=None):
          """Check whether this node is connected [to/from] whom.
  
          whom can be a list of nodes or a single node.
          direction can be "to" (default), "from", "both" or "either".
  
          If whom is a single node this method returns a boolean,
          otherwise it returns a list of booleans
          """
          if failed is not None:
              raise ValueError(
                  "You should not pass a failed argument to is_connected."
                  "is_connected is "
                  "unusual in that a failed argument cannot be passed. This is "
                  "because there is inherent uncertainty in what it means for a "
                  "connection to be failed. The is_connected function will only "
                  "ever check along not-failed vectors. "
                  "If you want to check along failed vectors "
                  "you should do so via sql queries."
              )
  
          # make whom a list
          if isinstance(whom, list):
              is_list = True
          else:
              whom = [whom]
              is_list = False
  
          whom_ids = [n.id for n in whom]
  
          # check whom contains only Nodes
          for node in whom:
              if not isinstance(node, Node):
                  raise TypeError(
                      "is_connected cannot parse objects of type {}.".format(type(node))
                  )
  
          # check direction
          if direction not in ["to", "from", "either", "both"]:
              raise ValueError(
                  "{} is not a valid direction for is_connected".format(direction)
              )
  
          # get is_connected
          connected = []
          if direction == "to":
              vectors = (
                  Vector.query.with_entities(Vector.destination_id)
                  .filter_by(origin_id=self.id, failed=False)
                  .all()
              )
              destinations = set([v.destination_id for v in vectors])
              for w in whom_ids:
                  connected.append(w in destinations)
  
          elif direction == "from":
              vectors = (
                  Vector.query.with_entities(Vector.origin_id)
                  .filter_by(destination_id=self.id, failed=False)
                  .all()
              )
              origins = set([v.origin_id for v in vectors])
              for w in whom_ids:
                  connected.append(w in origins)
  
          elif direction in ["either", "both"]:
  
              vectors = (
                  Vector.query.with_entities(Vector.origin_id, Vector.destination_id)
                  .filter(
                      and_(
                          Vector.failed == false(),
                          or_(
                              Vector.destination_id == self.id,
                              Vector.origin_id == self.id,
                          ),
                      )
                  )
                  .all()
              )
  
              destinations = set([v.destination_id for v in vectors])
              origins = set([v.origin_id for v in vectors])
  
              if direction == "either":
                  origins_destinations = destinations.union(origins)
  
              elif direction == "both":
                  origins_destinations = destinations.intersection(origins)
  
              for w in whom_ids:
                  connected.append(w in origins_destinations)
  
          if is_list:
              return connected
          else:
              return connected[0]