code: def call_duration(records, direction=None):
      
      if direction is None:
          call_durations = [r.call_duration for r in records]
      else:
          call_durations = [r.call_duration for r in records if r.direction == direction]
  
      return summary_stats(call_durations)
docs: The duration of the user's calls.
  
      Parameters
      ----------
      direction : str, optional
          Filters the records by their direction: ``None`` for all records,
          ``'in'`` for incoming, and ``'out'`` for outgoing.