def _validate_args(args, valid_args):
    """Validate args in format '--key=value'."""
    return {
        arg.replace("--", "").split("=")[0]: arg.replace("--", "").split("=")[1]
        for arg in args
        if arg.startswith("--") and "=" in arg and arg.replace("--", "").split("=")[0] in valid_args
    }