def get_pytwis(epilog):
    """Connect to the Redis database and return the Pytwis instance.

    Parameters
    ----------
    epilog: str
        An epilog string which will be displayed by ArgumentParser.

    Returns
    -------
    pytwis: A Pytwis instance.
    prompt: str
        The prompt string which contains either the hostname and the port or the socket.
    Raises
    ------
    ValueError
        If we fail to connect to the Redis server.
    """
    # Note that we set the conflict handler of ArgumentParser to 'resolve' because we reuse
    # the short help option '-h' for the host name.
    parser = argparse.ArgumentParser(conflict_handler="resolve",
                                     formatter_class=argparse.RawDescriptionHelpFormatter,
                                     description=\
                                     'Connect to the Redis database of a Twitter clone and '
                                     'then run commands to access and update the database.',
                                     epilog=epilog)
    parser.add_argument('-h', '--hostname', nargs='?', default='127.0.0.1',
                        help='''the Redis server hostname. If the option is not specified,
                             will be defaulted to 127.0.0.1. If the option is specified but
                             no value is given after the option, then the help information
                             is displayed instead.
                             ''')
    parser.add_argument('-p', '--port', default=6379,
                        help='''the Redis server port. If the option is not specified, will
                             be defaulted to 6379.
                             ''')
    parser.add_argument('-s', '--socket', default='',
                        help='''the Redis server socket (usually /tmp/redis.sock). If it is
                             given, it will override hostname and port. Make sure that the
                             unixsocket parameter is defined in your redis.conf file. It’s
                             commented out by default.
                             ''')
    parser.add_argument('-n', '--db', default=0,
                        help='''the Redis server database. If the option is not specified,
                             will be defaulted to 0.
                             ''')
    parser.add_argument('-a', '--password', default='',
                        help='''the Redis server password. If the option not specified,
                             will be defaulted to an empty string.
                             ''')

    args = parser.parse_args()

    # If no value is given after the option '-h', then the help information is displayed.
    if args.hostname is None:
        parser.print_help()
        return 0

    if args.socket:
        print('The input Redis server socket is {}'.format(args.socket))
        prompt = args.socket
    else:
        print('The input Redis server hostname is {}.'.format(args.hostname))
        print('The input Redis server port is {}.'.format(args.port))
        prompt = '{}:{}'.format(args.hostname, args.port)
    print('The input Redis server database is {}.'.format(args.db))
    if args.password != '':
        print('The input Redis server password is "{}".'.format(args.password))
    else:
        print('The input Redis server password is empty.')

    try:
        if args.socket:
            twis = pytwis.Pytwis(socket=args.socket,
                                 db=args.db,
                                 password=args.password)
        else:
            twis = pytwis.Pytwis(hostname=args.hostname,
                                 port=args.port,
                                 db=args.db,
                                 password=args.password)
        return twis, prompt

    except ValueError as excep:
        print('Failed to connect to the Redis server: {}'.format(str(excep)),
              file=sys.stderr)
        return None, None