def get_ec2_info(connection,<EOL>instance_id,<EOL>region,<EOL>username=None):
instance = connection.get_only_instances(<EOL>filters={'<STR_LIT>': instance_id}<EOL>)[<NUM_LIT:0>]<EOL>data = instance.__dict__<EOL>data['<STR_LIT:state>'] = instance.state<EOL>data['<STR_LIT>'] = '<STR_LIT>'<EOL>try:<EOL><INDENT>volume = connection.get_all_volumes(<EOL>filters={'<STR_LIT>': instance.id}<EOL>)[<NUM_LIT:0>].id<EOL>data['<STR_LIT>'] = volume<EOL><DEDENT>except:<EOL><INDENT>data['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>return data<EOL>
queries EC2 for details about a particular instance_id