def make_filename(s, space=None, language='<STR_LIT>', strict=False, max_len=None, repeats=<NUM_LIT>):
filename = None<EOL>if strict or language.lower().strip() in ('<STR_LIT:strict>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>if space is None:<EOL><INDENT>space = '<STR_LIT:_>'<EOL><DEDENT>elif not space:<EOL><INDENT>space = '<STR_LIT>'<EOL><DEDENT>filename = make_name(s, space=space, lower=False)<EOL><DEDENT>else:<EOL><INDENT>if space is None:<EOL><INDENT>space = '<STR_LIT:->'<EOL><DEDENT>elif not space:<EOL><INDENT>space = '<STR_LIT>'<EOL><DEDENT><DEDENT>if not filename:<EOL><INDENT>if language.lower().strip() in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>filename = re.sub(r'<STR_LIT>' + '<STR_LIT>'.format(repeats), space, s)<EOL><DEDENT>else:<EOL><INDENT>filename = re.sub(r'<STR_LIT>' + ('<STR_LIT>'.format(repeats)) + r'<STR_LIT:}>', space, s)<EOL><DEDENT><DEDENT>if max_len and int(max_len) > <NUM_LIT:0> and filename:<EOL><INDENT>return filename[:int(max_len)]<EOL><DEDENT>else:<EOL><INDENT>return filename<EOL><DEDENT>
r"""Process string to remove any characters not allowed by the language specified (default: MSDOS)

    In addition, optionally replace spaces with the indicated "space" character
    (to make the path useful in a copy-paste without quoting).

    Uses the following regular expression to substitute spaces for invalid characters:

        re.sub(r'[ :\\/?*&"<>|~`!]{1}', space, s)

    >>> make_filename(r'Whatever crazy &s $h!7 n*m3 ~\/ou/ can come up. with.`txt`!', strict=False)
    'Whatever-crazy-s-$h-7-n-m3-ou-can-come-up.-with.-txt-'
    >>> make_filename(r'Whatever crazy &s $h!7 n*m3 ~\/ou/ can come up. with.`txt`!', strict=False, repeats=1)
    'Whatever-crazy--s-$h-7-n-m3----ou--can-come-up.-with.-txt--'
    >>> make_filename(r'Whatever crazy &s $h!7 n*m3 ~\/ou/ can come up. with.`txt`!', repeats=1)
    'Whatever-crazy--s-$h-7-n-m3----ou--can-come-up.-with.-txt--'
    >>> make_filename(r'Whatever crazy &s $h!7 n*m3 ~\/ou/ can come up. with.`txt`!')
    'Whatever-crazy-s-$h-7-n-m3-ou-can-come-up.-with.-txt-'
    >>> make_filename(r'Whatever crazy &s $h!7 n*m3 ~\/ou/ can come up. with.`txt`!', strict=True, repeats=1)
    'Whatever_crazy_s_h_7_n_m3_ou_can_come_up_with_txt_'
    >>> make_filename(r'Whatever crazy &s $h!7 n*m3 ~\/ou/ can come up. with.`txt`!', strict=True, repeats=1, max_len=14)
    'Whatever_crazy'
    >>> make_filename(r'Whatever crazy &s $h!7 n*m3 ~\/ou/ can come up. with.`txt`!', max_len=14)
    'Whatever-crazy'