def _create_from_bytes(data, protobuf_klass):
    """Return a deserialized protobuf class from the passed in bytes data
    and the protobuf class.

    Args:
        data (bytes): The serialized protobuf.
        protobuf_klass (callable): The protobuf class. Either PolicyList or
            RolesList.

    Returns:
        Either RolesList or PolicyList
    """

    protobuf_instance = protobuf_klass()
    protobuf_instance.ParseFromString(data)
    return protobuf_instance