def find_package(package_specs, type_id):
    """
    Find the SBP package which defined type_id
    """
    for p in package_specs:
        for m in p.definitions:
            if m.identifier == type_id:
                return p.identifier.split(".", 2)[2]
    raise Exception("Can't find package for type %s" % type_id)