def _safe_name(file_name, sep):
file_name = stringify(file_name)<EOL>if file_name is None:<EOL><INDENT>return<EOL><DEDENT>file_name = ascii_text(file_name)<EOL>file_name = category_replace(file_name, UNICODE_CATEGORIES)<EOL>file_name = collapse_spaces(file_name)<EOL>if file_name is None or not len(file_name):<EOL><INDENT>return<EOL><DEDENT>return file_name.replace(WS, sep)<EOL>
Convert the file name to ASCII and normalize the string.