title: Mock boto3 batch write for unit testing in python
body: <p>I would like to test the batch_write method using unit test. </p>
  
  <pre><code>class DataService:
      def __init__(self, table):
          dynamodb = boto3.resource('dynamodb', region_name='us-west-2')
          self.db = dynamodb.Table(self.table)
  
  
      def batch_write(self, items):
          with self.db.batch_writer() as batch:
              for item in items:
                  batch.put_item(Item=item)
  </code></pre>
  
  <p>I want to mock the batch_writer(). I have seen usage of  mock_open used to mock file open methods. But I don't really understand can i mock this streaming batch_writer() call.</p>