code: def subdict(d, keep=None, drop=None, key=None, value=None):
      """Compute the "subdictionary" of a dict, `d`
  
      Parameters
      ----------
      d: Dict
          Dict whose keys will be filtered according to `keep` and `drop`
      keep: List, or callable, default=`d.keys()`
          Keys to retain in the returned subdict. If callable, return boolean given key input. `keep`
          may contain keys not in `d` without raising errors. `keep` may be better described as the
          keys allowed to be in the returned dict, whether or not they are in `d`. This means that if
          `keep` consists solely of a key not in `d`, an empty dict will be returned
      drop: List, or callable, default=[]
          Keys to remove from the returned subdict. If callable, return boolean given key input.
          `drop` may contain keys not in `d`, which will simply be ignored
      key: Callable, or None, default=None
          Transformation to apply to the keys included in the returned subdictionary
      value: Callable, or None, default=None
          Transformation to apply to the values included in the returned subdictionary
  
      Returns
      -------
      Dict
          New dict with any keys in `drop` removed and any keys in `keep` still present, provided they
          were in `d`. Calling `subdict` with neither `keep` nor `drop` is equivalent to `dict(d)`
  
      Examples
      --------
      >>> subdict({"a": 1, "b": 2})
      {'a': 1, 'b': 2}
      >>> subdict({"a": 1, "b": 2, "c": 3}, drop=["b", "c"])
      {'a': 1}
      >>> subdict({"a": 1, "b": 2, "c": 3}, keep=["a", "c"])
      {'a': 1, 'c': 3}
      >>> subdict({"a": 1, "b": 2, "c": 3}, drop=["b", "c"], key=lambda _: _.upper())
      {'A': 1}
      >>> subdict({"a": 1, "b": 2, "c": 3}, keep=["a", "c"], value=lambda _: _ * 10)
      {'a': 10, 'c': 30}
      >>> subdict({("foo", "a"): 1, ("foo", "b"): 2, ("bar", "c"): 3}, drop=lambda _: _[0] == "foo")
      {('bar', 'c'): 3}
      >>> subdict({("foo", "a"): 1, ("foo", "b"): 2, ("bar", "c"): 3}, keep=lambda _: _[0] == "foo")
      {('foo', 'a'): 1, ('foo', 'b'): 2}
      >>> subdict({(6, "a"): 1, (6, "b"): 2, (7, "c"): 3}, lambda _: _[0] == 6, key=lambda _: _[1])
      {'a': 1, 'b': 2}
      >>> subdict({"a": 1, "b": 2, "c": 3}, drop=["d"])
      {'a': 1, 'b': 2, 'c': 3}
      >>> subdict({"a": 1, "b": 2, "c": 3}, keep=["d"])
      {}
      >>> subdict({"a": 1, "b": 2, "c": 3}, keep=["b", "d"])
      {'b': 2}
      >>> subdict({"a": 1, "b": 2, "c": 3}, drop=["b", "c"], key="foo")
      Traceback (most recent call last):
          File "general_utils.py", line ?, in subdict
      TypeError: Expected callable `key` function
      >>> subdict({"a": 1, "b": 2, "c": 3}, drop=["b", "c"], value="foo")
      Traceback (most recent call last):
          File "general_utils.py", line ?, in subdict
      TypeError: Expected callable `value` function"""
      keep = keep or d.keys()
      drop = drop or []
      key = key or (lambda _: _)
      value = value or (lambda _: _)
  
      if not callable(key):
          raise TypeError("Expected callable `key` function")
      if not callable(value):
          raise TypeError("Expected callable `value` function")
  
      if callable(keep):
          keep = [_ for _ in d.keys() if keep(_)]
      if callable(drop):
          drop = [_ for _ in d.keys() if drop(_)]
  
      keys = set(keep) - set(drop)
      return dict(
          [(key(k), value(v)) for k, v in d.items() if k in keys]
      )
  
imports: from hyperparameter_hunter.utils.boltons_utils import remap, default_enter
  from datetime import datetime
  from inspect import Traceback
  import re
  import string
  from typing import Any, Callable, Iterable, List, Tuple, Union
  import wrapt
label_desc: Use image node_id 12 for calling a global function with example usage: subdict(d, keep, drop, key, value) and returns: dict