docs: def topports(sort_by='records', limit=10, date=None, return_format=None):
      """Information about top ports for a particular date with return limit.
  
      :param sort_by: one of 'records', 'targets', 'sources'
      :param limit: number of records to be returned
      :param date: an optional string in 'Y-M-D' format or datetime.date() object
      """
      uri = '/'.join(['topports', sort_by, str(limit)])
      if date:
          try:
              uri = '/'.join([uri, date.strftime("%Y-%m-%d")])
          except AttributeError:
              uri = '/'.join([uri, date])
      return _get(uri, return_format)