code: def get_attribute_by_alias(fields, alias, *, target=None):
      """
      Get an attrs attribute by its alias, rather than its name (compare
      getattr(fields, name)).
  
      ``target`` is used only to provide a nicer error message, and can be safely
      omitted.
      """
      # attrs supports defining an alias for a field, which is the name used when
      # defining __init__. The init args are what we pull from when determining
      # what parameters we need to supply to the class, so it's what we need to
      # match against as well, rather than the class-level attribute name.
      matched_fields = [f for f in fields if f.alias == alias]
      if not matched_fields:
          raise TypeError(
              f"Unexpected keyword argument {alias} for attrs class"
              f"{f' {target}' if target else ''}. Expected one of "
              f"{[f.name for f in fields]}"
          )
      # alias is used as an arg in __init__, so it is guaranteed to be unique, if
      # it exists.
      assert len(matched_fields) == 1
      return matched_fields[0]
  
file_path: catboost/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/attrs.py
imports: from functools import reduce
  from itertools import chain
  import attr
  from hypothesis import strategies
  from hypothesis.errors import ResolutionFailed
  from hypothesis.internal.compat import get_type_hints
  from hypothesis.strategies._internal.core import BuildsStrategy
  from hypothesis.strategies._internal.types import is_a_type, type_sorting_key
  from hypothesis.utils.conventions import infer
label_desc: Use image node_id 1 for calling a global function with example usage: get_attribute_by_alias(fields, alias) and returns: matched_fields