def get_role_id(role):
    """
    Get a role's ID.

    Args:
        role (obj): a Python object.

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