code: def from_lark(
      grammar: lark.lark.Lark,
      *,
      start: Optional[str] = None,
      explicit: Optional[Dict[str, st.SearchStrategy[str]]] = None,
  ) -> st.SearchStrategy[str]:
      """A strategy for strings accepted by the given context-free grammar.
  
      ``grammar`` must be a ``Lark`` object, which wraps an EBNF specification.
      The Lark EBNF grammar reference can be found
      `here <https://lark-parser.readthedocs.io/en/latest/grammar.html>`_.
  
      ``from_lark`` will automatically generate strings matching the
      nonterminal ``start`` symbol in the grammar, which was supplied as an
      argument to the Lark class.  To generate strings matching a different
      symbol, including terminals, you can override this by passing the
      ``start`` argument to ``from_lark``.  Note that Lark may remove unreachable
      productions when the grammar is compiled, so you should probably pass the
      same value for ``start`` to both.
  
      Currently ``from_lark`` does not support grammars that need custom lexing.
      Any lexers will be ignored, and any undefined terminals from the use of
      ``%declare`` will result in generation errors.  To define strategies for
      such terminals, pass a dictionary mapping their name to a corresponding
      strategy as the ``explicit`` argument.
  
      The :pypi:`hypothesmith` project includes a strategy for Python source,
      based on a grammar and careful post-processing.
      """
      check_type(lark.lark.Lark, grammar, "grammar")
      if explicit is None:
          explicit = {}
      else:
          check_type(dict, explicit, "explicit")
          explicit = {
              k: v.map(check_explicit(f"explicit[{k!r}]={v!r}"))
              for k, v in explicit.items()
          }
      return LarkStrategy(grammar, start, explicit)
  
file_path: catboost/contrib/python/hypothesis/py3/hypothesis/extra/lark.py
imports: from inspect import signature
  from typing import Dict, Optional
  import lark
  from lark.grammar import NonTerminal, Terminal
  from hypothesis import strategies
  from hypothesis.errors import InvalidArgument
  from hypothesis.internal.conjecture.utils import calc_label_from_name
  from hypothesis.internal.validation import check_type
  from hypothesis.strategies._internal.utils import cacheable, defines_strategy
label_desc: Use image node_id 3 for calling a global function with example usage: from_lark(grammar) and returns: LarkStrategy