parameters: (dictionary, allowed_extensions)
docstring: Delete every key in `dictionary` that doesn't have an allowed extension.
  
    `allowed_extensions` must be a collection of lowercase file extensions,
    excluding the period.
docstring_summary: Delete every key in `dictionary` that doesn't have an allowed extension.
docstring_tokens: Delete every key in dictionary that doesn t have an allowed extension .
function: def filter_by_extension(dictionary, allowed_extensions):
    """Delete every key in `dictionary` that doesn't have an allowed extension.
  
    `allowed_extensions` must be a collection of lowercase file extensions,
    excluding the period."""
    allowed_extensions = frozenset(allowed_extensions)
    for filename in list(dictionary.keys()):
      base_ext = filename.rsplit('.', 1)
      if len(base_ext) == 1 and '' in allowed_extensions:
          continue
      if len(base_ext) == 1 or base_ext[1].lower() not in allowed_extensions:
        del dictionary[filename]
function_tokens: def filter_by_extension ( dictionary , allowed_extensions ) : allowed_extensions = frozenset ( allowed_extensions ) for filename in list ( dictionary . keys ( ) ) : base_ext = filename . rsplit ( '.' , 1 ) if len ( base_ext ) == 1 and '' in allowed_extensions : continue if len ( base_ext ) == 1 or base_ext [ 1 ] . lower ( ) not in allowed_extensions : del dictionary [ filename ]