def METHOD_NAME(api, security_group_id, security_group_rule):
    ret = {'changed': False}
    response = api.get('security_groups/%s/rules' % security_group_id)
    if not response.ok:
        api.module.fail_json(
            msg='Error getting security group rules "%s": "%s" (%s)' %
            (response.info['msg'], response.json['message'], response.json))
    existing_rule = get_sgr_from_api(
        response.json['rules'], security_group_rule)
    if not existing_rule:
        return ret
    ret['changed'] = True
    if api.module.check_mode:
        return ret
    response = api.delete(
        '/security_groups/%s/rules/%s' %
        (security_group_id, existing_rule['id']))
    if not response.ok:
        api.module.fail_json(
            msg='Error deleting security group rule "%s": "%s" (%s)' %
            (response.info['msg'], response.json['message'], response.json))
    return ret