def is_versioned(obj):
    """
    Check if a given object is versioned by inspecting some of its attributes.
    """
    # before any heuristic, newer versions of RGW will tell if an obj is
    # versioned so try that first
    if hasattr(obj, 'versioned'):
        return obj.versioned

    if not hasattr(obj, 'VersionedEpoch'):
        # overly paranoid here, an object that is not versioned should *never*
        # have a `VersionedEpoch` attribute
        if getattr(obj, 'version_id', None):
            if obj.version_id is None:
                return False
            return True  # probably will never get here
        return False
    return True