def UnionCast(self):
    union_field = getattr(self, self.union_field)
    cast_field_name = str(union_field).lower()

    try:
      return getattr(self, cast_field_name)
    except __HOLE__:
      raise AttributeError("union_field not initialized.")
dataset/ETHPy150Open google/grr/grr/lib/rdfvalues/structs.py/RDFProtoStruct.UnionCast