code: def from_model(
      model,  # type: Type[dm.Model]
      **field_strategies,  # type: Union[st.SearchStrategy[Any], InferType]
  ):
      # type: (...) -> st.SearchStrategy[Any]
      """Return a strategy for examples of ``model``.
  
      .. warning::
          Hypothesis creates saved models. This will run inside your testing
          transaction when using the test runner, but if you use the dev console
          this will leave debris in your database.
  
      ``model`` must be an subclass of :class:`~django:django.db.models.Model`.
      Strategies for fields may be passed as keyword arguments, for example
      ``is_staff=st.just(False)``.
  
      Hypothesis can often infer a strategy based the field type and validators,
      and will attempt to do so for any required fields.  No strategy will be
      inferred for an :class:`~django:django.db.models.AutoField`, nullable field,
      foreign key, or field for which a keyword
      argument is passed to ``from_model()``.  For example,
      a Shop type with a foreign key to Company could be generated with::
  
          shop_strategy = from_model(Shop, company=from_model(Company))
  
      Like for :func:`~hypothesis.strategies.builds`, you can pass
      :obj:`~hypothesis.infer` as a keyword argument to infer a strategy for
      a field which has a default value instead of using the default.
      """
      if not issubclass(model, dm.Model):
          raise InvalidArgument(
              "model=%r must be a subtype of Model" % (model,)
          )
  
      fields_by_name = {f.name: f for f in model._meta.concrete_fields}
      for name, value in sorted(field_strategies.items()):
          if value is infer:
              field_strategies[name] = from_field(fields_by_name[name])
      for name, field in sorted(fields_by_name.items()):
          if (
              name not in field_strategies
              and not field.auto_created
              and field.default is dm.fields.NOT_PROVIDED
          ):
              field_strategies[name] = from_field(field)
  
      for field in field_strategies:
          if model._meta.get_field(field).primary_key:
              # The primary key is generated as part of the strategy. We
              # want to find any existing row with this primary key and
              # overwrite its contents.
              kwargs = {field: field_strategies.pop(field)}
              kwargs["defaults"] = st.fixed_dictionaries(field_strategies)  # type: ignore
              return _models_impl(
                  st.builds(model.objects.update_or_create, **kwargs)
              )
  
      # The primary key is not generated as part of the strategy, so we
      # just match against any row that has the same value for all
      # fields.
      return _models_impl(
          st.builds(model.objects.get_or_create, **field_strategies)
      )
  
imports: from __future__ import absolute_import, division, print_function
  import unittest
  from functools import partial
  import django.db.models
  import django.forms
  import django.test
  from django.core.exceptions import ValidationError
  from django.db import IntegrityError
  import hypothesis.strategies._internal.core
  from hypothesis import reject
  from hypothesis.errors import InvalidArgument
  from hypothesis.extra.django._fields import from_field
  from hypothesis.utils.conventions import infer
label_desc: Use image node_id 1 for calling a global function with example usage: from_model(model) and returns: _models_impl, _models_impl