def indices(iterable, elem):
    """
    Inputs:
      iterable - Any iterable
      elem     - Element to look for

    Output:
      A list of indices at which elem occurs in iterable.
      The list will be empty if elem never occurs.
    """
    result = []
    for idx, item in enumerate(iterable):
        if item == elem:
            result.append(idx)
    return result