code: def file_segment(filename):
      
      from ..segments import Segment
      try:  # CacheEntry
          return Segment(filename.segment)
      except AttributeError:  # file path (str)
          return filename_metadata(filename)[2]
docs: Return the data segment for a filename following T050017
  
      Parameters
      ---------
      filename : `str`, :class:`~lal.utils.CacheEntry`
          the path name of a file
  
      Returns
      -------
      segment : `~gwpy.segments.Segment`
          the ``[start, stop)`` GPS segment covered by the given file
  
      Notes
      -----
      |LIGO-T050017|_ declares a filenaming convention that includes
      documenting the GPS start integer and integer duration of a file,
      see that document for more details.