def exclude(source, keys, *, transform=None):
  """Returns a dictionary excluding keys from a source dictionary.

  :source: a dictionary
  :keys: a set of keys, or a predicate function that accepting a key
  :transform: a function that transforms the values
  """
  check = keys if callable(keys) else lambda key: key in keys
  return {key: transform(source[key]) if transform else source[key]
          for key in source if not check(key)}
Returns a dictionary excluding keys from a source dictionary.

  :source: a dictionary
  :keys: a set of keys, or a predicate function that accepting a key
  :transform: a function that transforms the values