def _response_ok(response, call_type):
    """
    Checks whether API HTTP response contains the associated OK code.
    :param response: Response object.
    :param call_type: String containing the HTTP request type.
    :return: True if response was OK.
    """
    ok_codes = {
        "GET": [200],
        "PUT": [200, 204],
        "POST": [201],
        "DELETE": [204],
    }

    return response.status_code in ok_codes[call_type]