title: Random.choice pulling entire list, instead of single items
body: <p>I am (continually) working on a project with gmail and imaplib. I am searching gmail for emails that contain a specific word, and receiving a list of unique ids (most of my code is based off of/is Doug Hellman's, from his excellent <a href="http://www.doughellmann.com/PyMOTW/imaplib/" rel="nofollow">imaplib tutorial</a>). Those unique ids are saved to a list. I am trying to pull a single id from the list, but random.choice keeps pulling the entire list. Here is the code: </p>
  
  <pre><code>import imaplib
  import random
  from imaplib_list_parse import parse_list_response
  
  c = imaplib_connect.open_connection()
  msg_ids = []
  c.select('[Gmail]/Chats', readonly=True)
  typ, msg_ids = c.search(None, '(BODY "friend")')
  random_id = random.choice(msg_ids)
  print random_id
  </code></pre>
  
  <p>I've messed around in the interpreter and msg_ids is definitely a list. I've also attempted to pull specific elements of the array (ex: msg_ids[1] etc) but it says "IndexError: list index out of range" which I understand to mean "the thing you are looking for isn't there", which is confusing because it is there. </p>
  
  <p>Is there anytime a list is not a list? Or something? I'm confused. </p>
  
  <p>As always, I appreciate any feedback the wonderful people of stackoverflow could give :)</p>