def _apply_user_agent(headers, user_agent):
 if (user_agent is not None):
  if ('user-agent' in headers):
   headers['user-agent'] = ((user_agent + ' ') + headers['user-agent'])
  else:
   headers['user-agent'] = user_agent
 return headers

def _apply_user_agent ( headers , user_agent ) : if ( user_agent is not None ) : if ( 'user-agent' in headers ) : headers [ 'user-agent' ] = ( ( user_agent + ' ' ) + headers [ 'user-agent' ] ) else : headers [ 'user-agent' ] = user_agent return headers
adds a user-agent to the headers .