def fast_deepcopy(obj):
    """This is a faster implementation of deepcopy via pickle.

    It is meant primarily for sets of Statements with complex hierarchies
    but can be used for any object.
    """
    with BytesIO() as buf:
        pickle.dump(obj, buf)
        buf.seek(0)
        obj_new = pickle.load(buf)
    return obj_new