docs: def make_filename(s, allow_whitespace=False, allow_underscore=False, allow_hyphen=False, limit=255, lower=False):
      r"""Make sure the provided string is a valid filename, and optionally remove whitespace
  
      >>> make_filename('Not so great!')
      'Notsogreat'
      >>> make_filename('')
      'empty'
      >>> make_filename('EOF\x00 EOL\n')
      'EOFEOL'
      >>> make_filename('EOF\x00 EOL\n', allow_whitespace=True)
      'EOF EOL\n'
      """
      s = stringify(s)
      s = CRE_BAD_FILENAME.sub('', s)
      if not allow_whitespace:
          s = CRE_WHITESPACE.sub('', s)
      if lower:
          s = str.lower(s)
      if not allow_hyphen:
          s = s.replace('-', '')
      if not allow_underscore:
          s = s.replace('_', '')
      if limit is not None:
          s = s[:limit]
      return s or 'empty'[:limit]