def intify(obj):
    """
    Takes an object that is a recursive composition of primitive types, lists and dictionaries, and returns an
    equivalent object where every `float` number that is actually an integer is replaced with the corresponding
    :obj:`int`.

    Args:
        obj: an object as specified.

    Returns:
        The modified version of ``obj``.
    """

    if isinstance(obj, list):
        return [intify(x) for x in obj]
    elif isinstance(obj, dict):
        return {k: intify(v) for k, v in obj.items()}
    elif isinstance(obj, float) and obj.is_integer():
        return int(obj)
    else:
        return obj