def perform_action(self, action_name, input_=None):
if action_name not in self.available_actions:<EOL><INDENT>return None<EOL><DEDENT>action_type = self.available_actions[action_name]<EOL>if '<STR_LIT:input>' in action_type['<STR_LIT>']:<EOL><INDENT>try:<EOL><INDENT>validate(input_, action_type['<STR_LIT>']['<STR_LIT:input>'])<EOL><DEDENT>except ValidationError:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>action = action_type['<STR_LIT:class>'](self, input_=input_)<EOL>action.set_href_prefix(self.href_prefix)<EOL>self.action_notify(action)<EOL>self.actions[action_name].append(action)<EOL>return action<EOL>
Perform an action on the thing.

action_name -- name of the action
input_ -- any action inputs

Returns the action that was created.