code: def number_of_contacts(records, direction=None, more=0):
      
      if direction is None:
          counter = Counter(r.correspondent_id for r in records)
      else:
          counter = Counter(r.correspondent_id for r in records if r.direction == direction)
      return sum(1 for d in counter.values() if d > more)
docs: The number of contacts the user interacted with.
  
      Parameters
      ----------
      direction : str, optional
          Filters the records by their direction: ``None`` for all records,
          ``'in'`` for incoming, and ``'out'`` for outgoing.
      more : int, default is 0
          Counts only contacts with more than this number of interactions.