<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def getAWSAccountID():
  '''
  Print an instance's AWS account number or 0 when not in EC2
  '''
  link = "http://169.254.169.254/latest/dynamic/instance-identity/document"
  try:
    conn = urllib2.urlopen(url=link, timeout=5)
  except urllib2.URLError:
    return '0'
  jsonData = json.loads(conn.read())
  return jsonData['accountId']