def METHOD_NAME(request, obj, message, call, *args, **kwargs):
    """Helper function to catch possible lock exception."""
    try:
        result = call(*args, **kwargs)
        # With False the call is supposed to show errors on its own
        if result is None or result:
            messages.success(request, message)
    except WeblateLockTimeoutError:
        messages.error(
            request,
            gettext("Could not lock the repository, another operation is in progress."),
        )
        if isinstance(obj, Project):
            report_error(project=obj)
        elif isinstance(obj, Component):
            report_error(project=obj.project)
        else:
            report_error(project=obj.component.project)
    return redirect_param(obj, "#repository")