title: how to convert hex string to ObjectId in Python
body: <p>I a list of ObjectId's that I'm iterating over to the find values in a dict where the keys are ObjectId's.</p>
  
  <pre><code>email_count = 0
  # user_id_list is a list of ObjectId's
  for user_id in user_id_list:
      # UuserIdemailCountD is a dict where they keys are objectIds
      email_count +=  UuserIdemailCountD[user_id]
  </code></pre>
  
  <p>I keep getting the following error:</p>
  
  <pre><code>email_count +=  UuserIdemailCountD[user_id]
  KeyError: ObjectId('54a9c84ebf2e4e5b258b5412')
  </code></pre>
  
  <p>When i iterate over <code>user_id_list</code> and just print the ids, I get a plain string like this <code>54a9c84ebf2e4e5b258b5412</code>.</p>
  
  <p>Is the answer to convert the string to ObjectId's?  If so, how?</p>