<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def SampleDist(samples, lo=None, up=None):
 """ Distribution based on samples. Estimates a distribution from the given samples by constructing a kernel density estimator (KDE). Args: samples: Sample values to construction of the KDE lo (float) : Location of lower threshold up (float) : Location of upper threshold Example: sample_dist(lo=0, up=2) [0. 0.6016 1. 1.3984 2. ] [0. 0.25 0.5 0.75 1. ] [0.2254 0.4272 0.5135 0.4272 0.2254] [-0.4123 1.1645 -0.0131 1.3302] 1.0 [[1.3835 0.7983 1.1872] [0.2429 0.2693 0.4102]] """

    samples = numpy.asarray(samples)
    if lo is None:
        lo = samples.min()
    if up is None:
        up = samples.max()

    try:
        #construct the kernel density estimator
        dist = sample_dist(samples, lo, up)

    #raised by gaussian_kde if dataset is singular matrix
    except numpy.linalg.LinAlgError:
        dist = Uniform(lower=-numpy.inf, upper=numpy.inf)

    return dist