code: def _encode_filename_to_filesystem(f):
      '''Get a unicode filename and return bytestring, encoded to file system default.
  
      If the argument already is a bytestring, return as is'''
      log.debug('_encode_filename_to_filesystem(%s)', repr(f))
      if isinstance(f, str):
          return f
      try:
          return f.encode(sys.getfilesystemencoding())
      except UnicodeEncodeError:
          raisf _encode_filename_to_filesystem(f):
      '''Get a unicode filename and return bytestring, encoded to file system default.
  
      If the argument already is a bytestring, return as is'''
      log.debug('_encode_filename_to_filesystem(%s)', repr(f))
      if isinstance(f, str):
          return f
      try:
          return f.encode(sys.getfilesystemencoding())
      except UnicodeEncodeError:
          raise
docs: Get a unicode filename and return bytestring, encoded to file system default.
  
      If the argument already is a bytestring, return as is