code: def _basic_auth_str(username, password):
      
  
      authstr = 'Basic ' + to_native_string(
          b64encode(('%s:%s' % (username, password)).encode('latin1')).strip()
      )
  
      return authstr
docs: Returns a Basic Auth string.