def METHOD_NAME(grammar):
    if hasattr(grammar, 'grammar_parse'):
        return (grammar,)
    if isinstance(grammar, str):
        return (modgrammar.LITERAL(grammar),)
    if grammar is None:
        return (modgrammar.EMPTY,)
    try:
        result = []
        for g in grammar:
            result.extend(METHOD_NAME(g))
        return tuple(result)
    except TypeError:
        raise modgrammar.GrammarDefError(
            "object of type '%s' cannot be converted to Grammar" % (type(grammar).__name__,))