def _json_clean(d):
    """Cleans the specified python `dict` by converting any tuple keys to
    strings so that they can be serialized by JSON.

    Args:
        d (dict): python dictionary to clean up.

    Returns:
        dict: cleaned-up dictionary.
    """
    result = {}
    compkeys = {}
    for k, v in d.items():
        if not isinstance(k, tuple):
            result[k] = v
        else:
            key = 'c.{}'.format(id(k))
            result[key] = v
            compkeys[key] = k
    return result, compkeys
