def decode_container_as_dict(container):
    """Decodes a container, i.e. the description of a location of a metadata table
    for CCPP. Currently, there are three possibilities with different numbers of
    input arguments: module, module+typedef, module+scheme+subroutine. Return
    a dictionary with possible keys MODULE, TYPE, SCHEME, SUBROUTINE."""
    items = container.split(' ')
    if not len(items) in [1, 2, 3]:
        raise Exception("decode_container not implemented for {0} items".format(len(items)))
    itemsdict = {}
    for i in range(len(items)):
        key, value = (items[i][:items[i].find('_')], items[i][items[i].find('_')+1:])
        itemsdict[key] = value
    return itemsdict