def METHOD_NAME(database_id, operation, tasks=None):
    from logical.models import Database
    database = Database.objects.get(id=database_id)
    url = _get_database_error_url(database_id)
    if database.is_in_quarantine:
        raise DatabaseInQuarantineError(operation, url)
    if database.is_being_used_elsewhere(tasks):
        raise BusyDatabaseError(url)
    return database