import six


def deep_copy(t):
    """
    Returns copy of dict *t*, follows nested dict structures
    """
    r = {}
    for k, v in six.iteritems(t):
        if isinstance(v, dict):
            r[k] = deep_copy(v)
        else:
            r[k] = v
    return r