code: def from_field(field):
      # type: (F) -> st.SearchStrategy[Union[F, None]]
      """Return a strategy for values that fit the given field.
  
      This function is used by :func:`~hypothesis.extra.django.from_form` and
      :func:`~hypothesis.extra.django.from_model` for any fields that require
      a value, or for which you passed :obj:`hypothesis.infer`.
  
      It's pretty similar to the core :func:`~hypothesis.strategies.from_type`
      function, with a subtle but important difference: ``from_field`` takes a
      Field *instance*, rather than a Field *subtype*, so that it has access to
      instance attributes such as string length and validators.
      """
      check_type((dm.Field, df.Field), field, "field")
      if getattr(field, "choices", False):
          choices = []  # type: list
          for value, name_or_optgroup in field.choices:
              if isinstance(name_or_optgroup, (list, tuple)):
                  choices.extend(key for key, _ in name_or_optgroup)
              else:
                  choices.append(value)
          # form fields automatically include an empty choice, strip it out
          if "" in choices:
              choices.remove("")
          min_size = 1
          if (
              isinstance(field, (dm.CharField, dm.TextField))
              and field.blank
          ):
              choices.insert(0, "")
          elif isinstance(field, (df.Field)) and not field.required:
              choices.insert(0, "")
              min_size = 0
          strategy = st.sampled_from(choices)
          if isinstance(
              field,
              (df.MultipleChoiceField, df.TypedMultipleChoiceField),
          ):
              strategy = st.lists(
                  st.sampled_from(choices), min_size=min_size
              )
      else:
          if type(field) not in _global_field_lookup:
              if getattr(field, "null", False):
                  return st.none()
              raise InvalidArgument(
                  "Could not infer a strategy for %r", (field,)
              )
          strategy = _global_field_lookup[type(field)]  # type: ignore
          if not isinstance(strategy, st.SearchStrategy):
              strategy = strategy(field)
      assert isinstance(strategy, st.SearchStrategy)
      if field.validators:
  
          def validate(value):
              try:
                  field.run_validators(value)
                  return True
              except django.core.exceptions.ValidationError:
                  return False
  
          strategy = strategy.filter(validate)
  
      if getattr(field, "null", False):
          return st.none() | strategy
      return strategy
  
imports: from __future__ import absolute_import, division, print_function
  import re
  import string
  from datetime import timedelta
  from decimal import Decimal
  import django
  import django.db.models
  import django.forms
  from django.core.validators import validate_ipv4_address, validate_ipv6_address, validate_ipv46_address
  import hypothesis.strategies
  from hypothesis.errors import InvalidArgument
  from hypothesis.extra.pytz import timezones
  from hypothesis.internal.validation import check_type
  from hypothesis.provisional import ip4_addr_strings, ip6_addr_strings, urls
  from hypothesis.strategies import emails
label_desc: Use image node_id 14 for calling a global function with example usage: from_field(field) and returns: strategy, unknown, st, True, False