def _get_server_type(doc):
 if (not doc.get('ok')):
  return SERVER_TYPE.Unknown
 if doc.get('isreplicaset'):
  return SERVER_TYPE.RSGhost
 elif doc.get('setName'):
  if doc.get('hidden'):
   return SERVER_TYPE.RSOther
  elif doc.get('ismaster'):
   return SERVER_TYPE.RSPrimary
  elif doc.get('secondary'):
   return SERVER_TYPE.RSSecondary
  elif doc.get('arbiterOnly'):
   return SERVER_TYPE.RSArbiter
  else:
   return SERVER_TYPE.RSOther
 elif (doc.get('msg') == 'isdbgrid'):
  return SERVER_TYPE.Mongos
 else:
  return SERVER_TYPE.Standalone

def _get_server_type ( doc ) : if ( not doc . get ( 'ok' ) ) : return SERVER_TYPE . Unknown if doc . get ( 'isreplicaset' ) : return SERVER_TYPE . RSGhost elif doc . get ( 'setName' ) : if doc . get ( 'hidden' ) : return SERVER_TYPE . RSOther elif doc . get ( 'ismaster' ) : return SERVER_TYPE . RSPrimary elif doc . get ( 'secondary' ) : return SERVER_TYPE . RSSecondary elif doc . get ( 'arbiterOnly' ) : return SERVER_TYPE . RSArbiter else : return SERVER_TYPE . RSOther elif ( doc . get ( 'msg' ) == 'isdbgrid' ) : return SERVER_TYPE . Mongos else : return SERVER_TYPE . Standalone
determine the server type from an ismaster response .