def argmin(x):
    """
    Returns the index of the smallest element of the iterable `x`.

    If two or more elements equal the minimum value, the index of the first
    such element is returned.

    >>> argmin([1, 3, 2, 0])
    3

    >>> argmin(abs(x) for x in range(-3, 4))
    3
    """
    argmin_ = None
    min_ = None
    for (nItem, item) in enumerate(x):
        if (argmin_ is None) or (item < min_):
            argmin_ = nItem
            min_ = item
    return argmin_