def get_mail_port(protocol):
    """
    This returns the server port to use for POP retrieval of mails
    :param protocol: The protocol to be used to fetch emails - IMAP or POP3
    :type protocol: basestring
    :return: Returns the correct port for either POP3 or POP3 over SSL
    :rtype: int
    """
    if protocol == 'POP3':
        port = 995
    elif 'IMAP' == protocol:
        port = 993
    else:
        raise Exception("Invalid options passed to get_mail_port")
    return port