code: def try_pop(d, key, default):
      
      value = d.get(key, default)
      if key in d:
          d.pop(key)
      return value
docs: >>> d = {"a": "b", "c": "d", "e": "f"}
      >>> try_pop(d, "g", "default")
      'default'
      >>> d
      {'a': 'b', 'c': 'd', 'e': 'f'}
      >>> try_pop(d, "c", "default")
      'd'
      >>> d
      {'a': 'b', 'e': 'f'}