def get_resource_id(resource):
    """
    Get a resource's ID.

    Args:
        resource (obj): a Python object.

    Returns:
        str: the resource's ID or None.
    """
    if hasattr(resource, 'resource_id'):
        attr = resource.resource_id
        if callable(attr):
            return attr()
        return attr
    elif hasattr(resource, 'id'):
        return resource.id
    return None
