code: def number_of_interactions(records, direction=None):
      
      if direction is None:
          return len(records)
      else:
          return len([r for r in records if r.direction == direction])
docs: The number of interactions.
  
      Parameters
      ----------
      direction : str, optional
          Filters the records by their direction: ``None`` for all records,
          ``'in'`` for incoming, and ``'out'`` for outgoing.