def get_function_namespace_id(self, iam_token):
    logger.debug('Getting name space id for {}'.format(self.cf_namespace))
    headers = {'content-type': 'application/json', 'Accept': 'application/json', 'Authorization': iam_token}
    url = '/'.join([self.cf_endpoint, 'api', 'v1', 'namespaces'])
    res = requests.get(url, headers=headers)
    if (res.status_code != 200):
        raise RuntimeError('Error: http code {} while listing namespaces.'.format(res.status_code))
    namespaces = res.json()
    for current_namespace in namespaces['namespaces']:
        if (('name' in current_namespace) and (current_namespace['name'] == self.cf_namespace)):
            logger.debug('Found name space id {} for {}'.format(current_namespace['id'], self.cf_namespace))
            return current_namespace['id']
    raise Exception('No IBM Cloud Functions namespace "{}" found.'.format(self.cf_namespace))
def get_function_namespace_id(self, iam_token):
    logger.debug('Getting name space id for {}'.format(self.cf_namespace))
    headers = {'content-type': 'application/json', 'Accept': 'application/json', 'Authorization': iam_token}
    url = '/'.join([self.cf_endpoint, 'api', 'v1', 'namespaces'])
    res = requests.get(url, headers=headers)
    if (res.status_code != 200):
        raise RuntimeError('Error: http code {} while listing namespaces.'.format(res.status_code))
    namespaces = res.json()
    for current_namespace in namespaces['namespaces']:
        if (('name' in current_namespace) and (current_namespace['name'] == self.cf_namespace)):
            logger.debug('Found name space id {} for {}'.format(current_namespace['id'], self.cf_namespace))
            return current_namespace['id']
    raise Exception('No IBM Cloud Functions namespace "{}" found.'.format(self.cf_namespace))