def METHOD_NAME(self, variable):
    if isinstance(variable, VariableMatch):
        return variable
    match = search_variable(variable)
    if not match.is_variable() or match.items:
        raise DataError("Invalid variable name '%s'." % variable)
    return match