def convert_epoch_iter(time, to, its_per_epoch=1):
    """
    Converts between iterations and epochs. 
    """
    measurement_type = time[-2:]
    if measurement_type == 'ep':
        if to == 'ep':
            return(int(time.strip('ep')))
        elif to == 'it':
            return(int(time.strip('ep')) * its_per_epoch)
        else:
            raise(NotImplementedError)
    elif measurement_type == 'it':
        if to == 'ep':
            return(float(time.strip('it')) / its_per_epoch)
        elif to == 'it':
            return(int(time.strip('it')))
        else:
            raise(NotImplementedError)
    else:
        raise(NotImplementedError)