code: def series(
      elements=None,  # type: st.SearchStrategy[Ex]
      dtype=None,  # type: Any
      index=None,  # type: st.SearchStrategy[Union[Sequence, pandas.Index]]
      fill=None,  # type: st.SearchStrategy[Ex]
      unique=False,  # type: bool
  ):
      # type: (...) -> st.SearchStrategy[pandas.Series]
      """Provides a strategy for producing a :class:`pandas.Series`.
  
      Arguments:
  
      * elements: a strategy that will be used to generate the individual
        values in the series. If None, we will attempt to infer a suitable
        default from the dtype.
  
      * dtype: the dtype of the resulting series and may be any value
        that can be passed to :class:`numpy.dtype`. If None, will use
        pandas's standard behaviour to infer it from the type of the elements
        values. Note that if the type of values that comes out of your
        elements strategy varies, then so will the resulting dtype of the
        series.
  
      * index: If not None, a strategy for generating indexes for the
        resulting Series. This can generate either :class:`pandas.Index`
        objects or any sequence of values (which will be passed to the
        Index constructor).
  
        You will probably find it most convenient to use the
        :func:`~hypothesis.extra.pandas.indexes` or
        :func:`~hypothesis.extra.pandas.range_indexes` function to produce
        values for this argument.
  
      Usage:
  
      .. code-block:: pycon
  
          >>> series(dtype=int).example()
          0   -2001747478
          1    1153062837
      """
      if index is None:
          index = range_indexes()
      else:
          st.check_strategy(index)
  
      elements, dtype = elements_and_dtype(elements, dtype)
      index_strategy = index
  
      @st.composite
      def result(draw):
          index = draw(index_strategy)
  
          if len(index) > 0:
              if dtype is not None:
                  result_data = draw(
                      npst.arrays(
                          dtype=dtype,
                          elements=elements,
                          shape=len(index),
                          fill=fill,
                          unique=unique,
                      )
                  )
              else:
                  result_data = list(
                      draw(
                          npst.arrays(
                              dtype=object,
                              elements=elements,
                              shape=len(index),
                              fill=fill,
                              unique=unique,
                          )
                      )
                  )
  
              return pandas.Series(
                  result_data, index=index, dtype=dtype
              )
          else:
              return pandas.Series(
                  (),
                  index=index,
                  dtype=dtype
                  if dtype is not None
                  else draw(dtype_for_elements_strategy(elements)),
              )
  
      return result()
  
imports: from __future__ import absolute_import, division, print_function
  from collections import OrderedDict
  from copy import copy
  import attr
  import numpy
  import pandas
  import hypothesis.extra.numpy
  import hypothesis.internal.conjecture.utils
  import hypothesis.strategies._internal.core
  from hypothesis.control import reject
  from hypothesis.errors import InvalidArgument
  from hypothesis.internal.compat import abc, hrange
  from hypothesis.internal.coverage import check, check_function
  from hypothesis.internal.validation import check_type, check_valid_interval, check_valid_size, try_convert
label_desc: Use image node_id 6 for calling a global function with example usage: series(elements, dtype, index, fill, unique) and returns: result, pandas, pandas