def METHOD_NAME(api_key, api_method, payload=None):
    '''
    Generic function which returns results back to calling function.
    Requires an API key and an API method to assemble the API URL.
    Returns response text to be analysed.
    '''
    # instantiate a response object
    response = Response()
    # if we've already started preloading the payload then copy it
    # and use that, otherwise we need to isntantiate it.
    if payload is None:
        payload = dict()
    else:
        payload = payload.copy()
    # set some sane defaults
    has_failed = False
    msg = None
    data = urlencode(payload)
    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    api_uri_base = 'https://api.memset.com/v1/json/'
    api_uri = '{0}{1}/' . format(api_uri_base, api_method)
    try:
        resp = open_url(api_uri, data=data, headers=headers, method="POST", force_basic_auth=True, url_username=api_key)
        response.content = resp.read().decode('utf-8')
        response.status_code = resp.getcode()
    except urllib_error.HTTPError as e:
        try:
            errorcode = e.code
        except AttributeError:
            errorcode = None
        has_failed = True
        response.content = e.read().decode('utf8')
        response.status_code = errorcode
        if response.status_code is not None:
            msg = "Memset API returned a {0} response ({1}, {2})." . format(response.status_code, response.json()['error_type'], response.json()['error'])
        else:
            msg = "Memset API returned an error ({0}, {1})." . format(response.json()['error_type'], response.json()['error'])
    except urllib_error.URLError as e:
        has_failed = True
        msg = "An URLError occured ({0})." . format(type(e))
        response.stderr = "{0}" . format(e)
    if msg is None:
        msg = response.json()
    return has_failed, msg, response