def METHOD_NAME(exception):
    status = next((code for exc, code in EXCEPTION_ERROR_MAP.items() if isinstance(exception, exc)), 500)
    if isinstance(status, int):
        return status
    try:
        return status(exception)
    except Exception:
        return 500