def down_ec2(connection, instance_id, region, log=False):
<EOL>instance = connection.stop_instances(instance_ids=instance_id)[<NUM_LIT:0>]<EOL>while instance.state != "<STR_LIT>":<EOL><INDENT>if log:<EOL><INDENT>log_yellow("<STR_LIT>" % instance.state)<EOL><DEDENT>sleep(<NUM_LIT:10>)<EOL>instance.update()<EOL><DEDENT>if log:<EOL><INDENT>log_green('<STR_LIT>' % instance.state)<EOL><DEDENT>
shutdown of an existing EC2 instance