def dict_remove_key_safe(d, key, default=None):
    """
    removes a key from dict __WITHOUT__ side effects

    Returns:
     - copy of dict, without key
     - value (if it was there)
    """
    d = d.copy()
    value = d.pop(key, default)
    return d, value
