def METHOD_NAME(api, wished_fn):
    fn_list = api.fetch_all_resources("functions")
    fn_lookup = dict((fn["name"], fn)
                     for fn in fn_list)
    if wished_fn["name"] not in fn_lookup:
        msg = "Error during function lookup: Unable to find function named '%s' in namespace '%s'" % (wished_fn["name"],
                                                                                                      wished_fn["namespace_id"])
        api.module.fail_json(msg=msg)
    target_fn = fn_lookup[wished_fn["name"]]
    response = api.get(path=api.api_path + "/%s" % target_fn["id"])
    if not response.ok:
        msg = "Error during function lookup: %s: '%s' (%s)" % (response.info['msg'],
                                                               response.json['message'],
                                                               response.json)
        api.module.fail_json(msg=msg)
    return response.json