def METHOD_NAME(self, request, host_migrate, operation):
    success = True
    if success and not host_migrate.is_status_error:
        success = False
        messages.add_message(
            request, messages.ERROR,
            "You can not do {} because current status is '{}'".format(
                operation, host_migrate.get_status_display()
            ),
        )
    if success and not host_migrate.can_do_retry:
        success = False
        messages.add_message(
            request, messages.ERROR,
            "{} is disabled".format(operation.capitalize())
        )
    return success, HttpResponseRedirect(
        reverse(
            'admin:maintenance_hostmigrate_change', args=(host_migrate.id,)
        )
    )