def argmin(indexable, key=None):
if key is None and isinstance(indexable, collections_abc.Mapping):<EOL><INDENT>return min(indexable.items(), key=operator.itemgetter(<NUM_LIT:1>))[<NUM_LIT:0>]<EOL><DEDENT>elif hasattr(indexable, '<STR_LIT:index>'):<EOL><INDENT>if key is None:<EOL><INDENT>return indexable.index(min(indexable))<EOL><DEDENT>else:<EOL><INDENT>return indexable.index(min(indexable, key=key))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return argsort(indexable, key=key)[<NUM_LIT:0>]<EOL><DEDENT>
Returns index / key of the item with the smallest value.

This is similar to `numpy.argmin`, but it is written in pure python and
works on both lists and dictionaries.

Args:
    indexable (Iterable or Mapping): indexable to sort by

    key (Callable, optional): customizes the ordering of the indexable

Example:
    >>> assert argmin({'a': 3, 'b': 2, 'c': 100}) == 'b'
    >>> assert argmin(['a', 'c', 'b', 'z', 'f']) == 0
    >>> assert argmin([[0, 1], [2, 3, 4], [5]], key=len) == 2
    >>> assert argmin({'a': 3, 'b': 2, 3: 100, 4: 4}) == 'b'
    >>> assert argmin(iter(['a', 'c', 'A', 'z', 'f'])) == 2