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:
        raise
def _encode_filename_to_filesystem ( f ) : log . debug ( '_encode_filename_to_filesystem(%s)' , repr ( f ) ) if isinstance ( f , str ) : return f try : return f . encode ( sys . getfilesystemencoding ( ) ) except UnicodeEncodeError : raise
Get a unicode filename and return bytestring, encoded to file system default.

    If the argument already is a bytestring, return as is