def authentication(self, username, password):
        """Configures the user authentication for eAPI

        This method configures the username and password combination to use
        for authenticating to eAPI.

        Args:
            username (str): The username to use to authenticate the eAPI
                connection with
            password (str): The password in clear text to use to authenticate
                the eAPI connection with

        """
        # Work around for Python 2.7/3.x compatibility
        if int(sys.version[0]) > 2:
            # For Python 3.x
            _auth_text = '{}:{}'.format(username, password)
            _auth_bin = base64.encodebytes(_auth_text.encode())
            _auth = _auth_bin.decode()
            _auth = _auth.replace('\n', '')
            self._auth = _auth
        else:
            # For Python 2.7
            _auth = base64.encodestring('{}:{}'.format(username, password))
            self._auth = str(_auth).replace('\n', '')

        _LOGGER.debug('Autentication string is: {}'.format(self._auth))
dataset/ETHPy150Open arista-eosplus/pyeapi/pyeapi/eapilib.py/EapiConnection.authentication/original