imm_persist(imm) turns imm from a transient into a persistent immutable and returns imm. If imm
    is already persistent, then it is simply returned.

def imm_persist(imm):
    '''
    imm_persist(imm) turns imm from a transient into a persistent immutable and returns imm. If imm
    is already persistent, then it is simply returned.
    '''
    if not is_imm(imm):
        raise ValueError('imm_persist given non-immutable')
    if not _imm_is_persist(imm):
        _imm_trans_to_persist(imm)
    return imm