def get_outputportnum(port):

    """ Get the output port number corresponding to the port letter """

    portnum = {
        'a': 0,
        'b': 1,
        'c': 2,
        'd': 3
    }
    port = port.lower()
    if type(port) is not str:
        raise NameError('Invalid output port.')
    if port not in list(portnum.keys()):
        raise NameError('Invalid output port.')
    return portnum[port]