code: def _get_logger_file_handles(self):
          
          handles = []
          for handler in self.logger.handlers:
              # The following code works for logging's SysLogHandler,
              # StreamHandler, SocketHandler, and their subclasses.
              for attr in ['sock', 'socket', 'stream']:
                  try:
                      handle = getattr(handler, attr)
                      if handle:
                          handles.append(handle)
                      break
                  except AttributeError:
                      continue
          return handles
docs: Find the file handles used by our logger's handlers.