def GetInstance(region, instance_id):
 try:
  matches = ListInstances(region, instances=[instance_id])
 except EC2ResponseError as e:
  if (e.error_code == 'InvalidInstanceID.NotFound'):
   return None
  raise
 if (len(matches) == 0):
  return None
 assert (len(matches) == 1)
 return matches[0]

def GetInstance ( region , instance_id ) : try : matches = ListInstances ( region , instances = [ instance_id ] ) except EC2ResponseError as e : if ( e . error_code == 'InvalidInstanceID.NotFound' ) : return None raise if ( len ( matches ) == 0 ) : return None assert ( len ( matches ) == 1 ) return matches [ 0 ]
find a specific instance given its id .