'Set the mode and the direction of a given pin.'

def set_mode(self, pin, direction, mode):

    if ((mode == 'analog') and (direction == 'in')):
        self._board.set_pin_mode(pin, self._board.INPUT, self._board.ANALOG)
    elif ((mode == 'analog') and (direction == 'out')):
        self._board.set_pin_mode(pin, self._board.OUTPUT, self._board.ANALOG)
    elif ((mode == 'digital') and (direction == 'in')):
        self._board.set_pin_mode(pin, self._board.INPUT, self._board.DIGITAL)
    elif ((mode == 'digital') and (direction == 'out')):
        self._board.set_pin_mode(pin, self._board.OUTPUT, self._board.DIGITAL)
    elif (mode == 'pwm'):
        self._board.set_pin_mode(pin, self._board.OUTPUT, self._board.PWM)
