code: def from_any_pb(pb_type, any_pb):
      
      msg = pb_type()
  
      # Unwrap proto-plus wrapped messages.
      if callable(getattr(pb_type, "pb", None)):
          msg_pb = pb_type.pb(msg)
      else:
          msg_pb = msg
  
      # Unpack the Any object and populate the protobuf message instance.
      if not any_pb.Unpack(msg_pb):
          raise TypeError(
              "Could not convert {} to {}".format(
                  any_pb.__class__.__name__, pb_type.__name__
              )
          )
  
      # Done; return the message.
      return msg
docs: Converts an ``Any`` protobuf to the specified message type.
  
      Args:
          pb_type (type): the type of the message that any_pb stores an instance
              of.
          any_pb (google.protobuf.any_pb2.Any): the object to be converted.
  
      Returns:
          pb_type: An instance of the pb_type message.
  
      Raises:
          TypeError: if the message could not be converted.