title: AWS Lambda error (module initialization error: name 'dynamodb' is not defined) with dynamodb
body: <p>I'm trying to run a lambda function that takes an <code>attribute</code> about the AWS IoT Dash button, its <code>serialNumber</code>, and queries it in DynamoDB. Consequently, it is supposed to print the entire row.</p>
  
  <p>Here is the code ---></p>
  
  <pre><code>from __future__ import print_function
  import boto3
  import json
  import decimal
  from boto3.dynamodb.conditions import Key, Attr
  
  def lambda_handler(event, context):
  print ('Init 1Push_Care_DATAprint')
  print (event)
  serialNumber = event['serialNumber']
  
  class DecimalEncoder(json.JSONEncoder):
      def default(self, o):
          if isinstance(o, decimal.Decimal):
              if o % 1 &gt; 0:
                  return float(o)
          else:
              return int(o)
  return super(DecimalEncoder, self).default(o)
  
  dynamodb = boto3.resource('dynamodb',region_name='us-east-1')
  
  table = dynamodb.Table('1Push_Care_USERinfo')
  
  response = table.query(
  KeyConditionExpression=Key('Device_ID').eq('serialNumber')
  )
  items = response['Items']
  print(items)
  </code></pre>
  
  <p>Here is the error message I keep receiving ---></p>
  
  <pre><code>module initialization error: name 'dynamodb' is not defined
  </code></pre>