def handle_command(pymux, input_string):
    """
    Handle command.
    """
    assert isinstance(input_string, six.text_type)

    input_string = input_string.strip()
    logger.info('handle command: %s %s.', input_string, type(input_string))

    if input_string and not input_string.startswith('#'):  # Ignore comments.
        try:
            if six.PY2:
                # In Python2.6, shlex doesn't work with unicode input at all.
                # In Python2.7, shlex tries to encode using ASCII.
                parts = shlex.split(input_string.encode('utf-8'))
                parts = [p.decode('utf-8') for p in parts]
            else:
                parts = shlex.split(input_string)
        except ValueError as e:
            # E.g. missing closing quote.
            pymux.show_message('Invalid command %s: %s' % (input_string, e))
        else:
            call_command_handler(parts[0], pymux, parts[1:])
Handle command.