docstr: Given a rule name, creates an optional ply.yacc rule
  for it. The name of the optional rule is
  <rulename>_opt
docstr_tok: ["Given","a","rule","name",",","creates","an","optional","ply.yacc","rule","for","it",".","The","name","of","the","optional","rule","is","<","rulename",">","_opt"]
code: def _create_opt_rule(self, rulename):
      """Given a rule name, creates an optional ply.yacc rule
      for it. The name of the optional rule is
      <rulename>_opt
      """
      optname = rulename + "_opt"
  
      def optrule(self, p):
          p[0] = p[1]
  
      optrule.__doc__ = "%s : empty\n| %s" % (optname, rulename)
      optrule.__name__ = "p_%s" % optname
      setattr(self.__class__, optrule.__name__, optrule)
  
file_path: catboost/contrib/python/pycparser/py3/pycparser/plyparser.py
imports: import warnings
label_desc: Use image node_id 1 for calling the PLYParser obj's underlying member method code with example usage: obj._create_opt_rule(rulename) without return types