import json


def _parse_option(option):
    """
    Parse a 'key=val' option string into a python (key, val) pair

    :param option: str
    :return: tuple
    """
    try:
        key, val = option.split("=", 1)
    except ValueError:
        return option, True

    try:
        val = json.loads(val)
    except json.JSONDecodeError:
        pass

    return key, val