import pkgutil


def read_resource(resource_path, package_name):
    """ Reads resource files packaged with the python library """
    data = None
    # print("trying resource package: {}; {}".format(package_name, resource_path))
    try:
        data = pkgutil.get_data(package_name, resource_path)
        # print("data type: {}".format(type(data)))
    except:
        pass
    return data