code: def _timedelta_to_seconds(td):
          
          if isinstance(td, numbers.Real):
              td = datetime.timedelta(seconds=td)
          return td.total_seconds()
docs: Convert a datetime.timedelta object into a seconds interval for
          rotating file ouput.
  
          :param td: datetime.timedelta
          :return: time in seconds
          :rtype: int