<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def madmedianrule(a):
 """Outlier detection based on the MAD-median rule. Parameters a : array-like Input array. Returns ------- outliers: boolean (same shape as a) Boolean array indicating whether each sample is an outlier (True) or not (False). References .. [1] Hall, P., Welsh, A.H., 1985. Limit theorems for the median deviation. Ann. Inst. Stat. Math. 37, 27–36. https://doi.org/10.1007/BF02481078 Examples -------- array([False, False, False, False, False, True, False, False]) """

    from scipy.stats import chi2
    a = np.asarray(a)
    k = np.sqrt(chi2.ppf(0.975, 1))
    return (np.fabs(a - np.median(a)) / mad(a)) > k