def kwargs_to_flags(**kwargs):
    """Convert `kwargs` to flags to pass on to CLI."""
    flag_strings = []
    for (key, val) in kwargs.items():
        if isinstance(val, bool):
            if val:
                flag_strings.append(f"--{key}")
        else:
            flag_strings.append(f"--{key}={val}")
    return " ".join(flag_strings)