Sets the gpio mode.

        gpio:= 0-53.
        mode:= INPUT, OUTPUT, ALT0, ALT1, ALT2, ALT3, ALT4, ALT5.

        ...
        pi.set_mode( 4, apigpio.INPUT)  # gpio  4 as input
        pi.set_mode(17, apigpio.OUTPUT) # gpio 17 as output
        pi.set_mode(24, apigpio.ALT2)   # gpio 24 as ALT2
        ...

def set_mode(self, gpio, mode):
        """
        Sets the gpio mode.

        gpio:= 0-53.
        mode:= INPUT, OUTPUT, ALT0, ALT1, ALT2, ALT3, ALT4, ALT5.

        ...
        pi.set_mode( 4, apigpio.INPUT)  # gpio  4 as input
        pi.set_mode(17, apigpio.OUTPUT) # gpio 17 as output
        pi.set_mode(24, apigpio.ALT2)   # gpio 24 as ALT2
        ...
        """
        res = yield from self._pigpio_aio_command(_PI_CMD_MODES, gpio, mode)
        return _u2i(res)