def _keys(d):
    """
    Return a list of the keys of C{d}.

    @type d: L{dict}
    @rtype: L{list}
    """
    if _PY3:
        return list(d.keys())
    else:
        return d.keys()

    Return a list of the keys of C{d}.

    @type d: L{dict}
    @rtype: L{list}
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/compat.py