def __init__(self, **kwargs):

        self.sessp = None   # single session api pointer
        self.session = None # session struct
        self.session_template = types.netsnmp_session()
        self._requests = {}

        self._use_bulk = kwargs.pop('_use_bulk', True)

        # Initialize session to default values
        lib.snmp_sess_init(byref(self.session_template))

        # Convert from a string to the numeric constant
        if 'version' not in kwargs:
            raise SnmpError("Keyword version is required")
        elif kwargs['version'] == '1':
            kwargs['version'] = const.SNMP_VERSION_1
            self._use_bulk = False
        elif kwargs['version'] == '2c':
            kwargs['version'] = const.SNMP_VERSION_2c
        else:
            raise SnmpError("Invalid version: %r" % kwargs['version'])

        if 'peername' not in kwargs:
            raise SnmpError("Keyword peername is required")
        elif not isinstance(kwargs['peername'], str):
            raise SnmpError("Invalid peername, must be a str")

        # Check community is a str, set community_len
        if 'community' not in kwargs:
            raise SnmpError("Keyword community is required")
        elif not isinstance(kwargs['community'], str):
            raise SnmpError("Invalid community, must be a str")
        else:
            kwargs['community_len'] = len(kwargs['community'])

        # Convert from seconds to microseconds
        if 'timeout' in kwargs:
            kwargs['timeout'] = int(kwargs['timeout'] * 1e6)

        for attr, value in kwargs.iteritems():
            setattr(self.session_template, attr, value)

        # We must hold a reference to the callback while it is in use
        self._session_callback = types.netsnmp_callback(self._callback)
        self.session_template.callback = self._session_callback
The keywords set various options in struct snmp_session.
dataset/ETHPy150Open marineam/nagcat/python/snapy/netsnmp/__init__.py/Session.__init__