def split(self, max_commands):
a_prior = Action(**self.frame)<EOL>a_prior.commands = list(self.commands)<EOL>self.split_actions = [a_prior]<EOL>while len(a_prior.commands) > max_commands:<EOL><INDENT>a_next = Action(**self.frame)<EOL>a_prior.commands, a_next.commands = a_prior.commands[<NUM_LIT:0>:max_commands], a_prior.commands[max_commands:]<EOL>self.split_actions.append(a_next)<EOL>a_prior = a_next<EOL><DEDENT>return self.split_actions<EOL>
Split this action into an equivalent list of actions, each of which have at most max_commands commands.
:param max_commands: max number of commands allowed in any action
:return: the list of commands created from this one