def get_instance_state(self, instances=None):
if instances:<EOL><INDENT>desc = self.client.describe_instances(InstanceIds=instances)<EOL><DEDENT>else:<EOL><INDENT>desc = self.client.describe_instances(InstanceIds=self.instances)<EOL><DEDENT>for i in range(len(desc['<STR_LIT>'])):<EOL><INDENT>instance = desc['<STR_LIT>'][i]['<STR_LIT>'][<NUM_LIT:0>]<EOL>self.instance_states[instance['<STR_LIT>']] = instance['<STR_LIT>']['<STR_LIT:Name>']<EOL><DEDENT>return self.instance_states<EOL>
Get states of all instances on EC2 which were started by this file.