<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dist_iter(self, g_nums, ats_1, ats_2, invalid_error=False):
 """ Iterator over selected interatomic distances. Distances are in Bohrs as with :meth:`dist_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters g_nums |int| or length-R iterable |int| or |None| -- Index/indices of the desired geometry/geometries ats_1 |int| or iterable |int| or |None| -- Index/indices of the first atom(s) ats_2 |int| or iterable |int| or |None| -- Index/indices of the second atom(s) invalid_error |bool|, optional -- If |False| (the default), |None| values are returned for results corresponding to invalid indices. If |True|, exceptions are raised per normal. Yields ------ dist |npfloat_| -- Interatomic distance in Bohrs between each atom pair of `ats_1` and `ats_2` from the corresponding geometries of `g_nums`. Raises ------ ~exceptions.IndexError If an invalid (out-of-range) `g_num` or `at_#` is provided. ~exceptions.ValueError If all iterable objects are not the same length. """


        # Imports
        import numpy as np
        from .utils import pack_tups

        # Print the function inputs if debug mode is on
        if _DEBUG:  # pragma: no cover
            print("g_nums = {0}".format(g_nums))
            print("ats_1 = {0}".format(ats_1))
            print("ats_2 = {0}".format(ats_2))
        ## end if

        # Perform the None substitution
        arglist = self._none_subst(g_nums, ats_1, ats_2)

        # Expand/pack the tuples from the inputs
        tups = pack_tups(*arglist)

        # Dump the results if debug mode is on
        if _DEBUG:  # pragma: no cover
            print(tups)
        ## end if

        # Construct the generator using the packed tuples. If 'None' expansion
        #  was used, return None for any invalid indices instead of raising
        #  an exception.
        for tup in tups:
            yield self._iter_return(tup, self.dist_single, invalid_error)