<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_distance_metric(self, distance_fun_name, distance_fun_module, with_x):
 """ Takes a function that computes a distance matrix for points in some coordinate system and returns self's covariance function wrapped to use that distance function. Uses function apply_distance, which was used to produce self.euclidean and self.geographic and their docstrings. :Parameters: - `distance_fun`: Creates a distance matrix from two np.arrays of points, where the first index iterates over separate points and the second over coordinates. In addition to the arrays x and y, distance_fun should take an argument called symm which indicates whether x and y are the same array. :SeeAlso: - `apply_distance()` """


        if self.ampsq_is_diag:
            kls = covariance_wrapper_with_diag
        else:
            kls = covariance_wrapper
        new_fun = kls(self.cov_fun_name, self.cov_fun_module, self.extra_cov_params, distance_fun_name, distance_fun_module, with_x=with_x)
        self.wrappers.append(new_fun)
        # try:
        setattr(self, distance_fun_name, new_fun)
        # except:
        #     pass
        return new_fun