'Transform the Reference protobuffer which underlies keys and references.
Args:
entity_namespace: The \'before\' namespace of the entity that has this
reference property.  If this value does not match the reference
properties current namespace, then the reference property namespace will
not be modified.
reference_proto: A Onestore Reference proto'

def rewrite_reference_proto(self, entity_namespace, reference_proto):

    reference_proto.set_app(self.app_id)
    if (entity_namespace != reference_proto.name_space()):
        return
    if self.namespace:
        reference_proto.set_name_space(self.namespace)
    else:
        reference_proto.clear_name_space()
