def getid(obj):
    """Return id if argument is a Resource.

    Abstracts the common pattern of allowing both an object or an object's ID
    (UUID) as a parameter when dealing with relationships.
    """
    if getattr(obj, 'uuid', None):
        return obj.uuid
    else:
        return getattr(obj, 'id', obj)
