def parse_address(string):
    """Parses the address and port number from the command line.
    Returns addres and port. Both can be None if config should be used instead.
    """
    if string is None:
        return None, None

    if ':' in string:
        addr, port = string.split(':')
        return addr, int(port)

    if '.' in string: # ip address
        return string, None

    return '', int(string)