code: def basic_auth_string(username, password):
      
      b64 = base64.encodestring('%s:%s' % (username, password)).strip()
      return 'Basic %s' % b64
docs: Encode a username and password for use in an HTTP Basic Authentication
      header