def HandleMessage(self, message):
    """Consume a message and execute the client action."""
    message.auth_state = rdf_flows.GrrMessage.AuthorizationState.AUTHENTICATED

    # We allow special methods to be specified for certain actions.
    if hasattr(self, message.name):
      return getattr(self, message.name)(message.payload)

    self.RecordCall(message.name, message.payload)

    # Try to retrieve a suspended action from the client worker.
    try:
      suspended_action_id = message.payload.iterator.suspended_action
      action = self.client_worker.suspended_actions[suspended_action_id]

    except (__HOLE__, KeyError):
      # Otherwise make a new action instance.
      action_cls = self.action_classes[message.name]
      action = action_cls(grr_worker=self.client_worker)

    action.Execute(message)
    self.action_counts[message.name] += 1

    return self.client_worker.Drain()
dataset/ETHPy150Open google/grr/grr/lib/action_mocks.py/ActionMock.HandleMessage