def METHOD_NAME(obj, request, verb="write", scope=None):
    user = request.user
    if not user.is_authenticated:
        # No authentication, no access
        return False
    # OAuth token
    token = getattr(request, "auth", None)
    if token and (not scope or not token.is_valid([scope])):
        return False
    if hasattr(obj, "user") and obj.user_id == user.id:
        # The object owner always has the capability
        return True
    if user.is_superuser:
        # Superusers can do everything
        return True
    if check_permission(obj, request, verb):
        return True
    if hasattr(obj, "team") and obj.team and obj.team.can_do(verb, user):
        return True
    return False