import six


def dslice(value, *args):
    """Returns a 'slice' of the given dictionary value containing only the
       requested keys. The keys can be requested in a variety of ways, as an
       arg list of keys, as a list of keys, or as a dict whose key(s) represent
       the source keys and whose corresponding values represent the resulting 
       key(s) (enabling key rename), or any combination of the above.""" 
    result = {}
    for arg in args:
        if isinstance(arg, dict):
            for k, v in six.iteritems(arg):
                if k in value: 
                    result[v] = value[k]
        elif isinstance(arg, list):
            for k in arg:
                if k in value: 
                    result[k] = value[k]
        else:
            if arg in value: 
                result[arg] = value[arg]
    return result