import copy


def regularize(l):
    """ 
If necessary mix in a small prior for regularization.
"""
    epsilon=1e-3
    l=copy.copy(l)
    for i in range(0,len(l)):
        if l[i]==0:
            l[i]=epsilon
    return l