def get_conf(conf='MAY', as_dict=False):
    if as_dict:
        return [X.Extension(dict(
            url=conf_url,
            valueCode=conf
        )).as_json()]
    else:
        return [X.Extension(dict(
            url=conf_url,
            valueCode=conf
        ))]
def get_combo_ext(r_type, combos):
    x_list = []
    for combo in combos:
        # convert to extension
        combo_ext = X.Extension()
        combo_ext.url = combo_url
        combo_conf_ext = get_conf(combo[1])
        combo_ext.extension = combo_conf_ext
        for param in combo[0].split(','):
            req_combo = X.Extension(
                dict(
                    url='required',
                    valueString=param  # http://hl7.org/fhir/us/core/SearchParameter/us-core-patient-family
                )
            )
            combo_ext.extension.append(req_combo)
        x_list.append(combo_ext)
    return x_list
def get_addin_ext(py_ext, json_ext):
    if json_ext:   # ie not ''
        addin_ext = X.Extension(loads(json_ext))
        py_ext.append(addin_ext)  # add in other extensions
    return py_ext