Get state of instance for cache signature (as part of key).

    Attempts to get state will be done in this order:

    - instance._getsate_bucketcache_()
    - instance.__getstate__()
    - instance.__dict__

def get_instance_signature(instance):
    """Get state of instance for cache signature (as part of key).

    Attempts to get state will be done in this order:

    - instance._getsate_bucketcache_()
    - instance.__getstate__()
    - instance.__dict__
    """
    with suppress(AttributeError):
        return instance._getsate_bucketcache_()

    with suppress(AttributeError):
        return instance.__getstate__()

    return instance.__dict__