def METHOD_NAME(chgcar, diff_thresh=None):
    """
    Check if the charge density file is corrupt
    Args:
        chgcar (Chgcar): Chgcar-like object.
        diff_thresh (Float): Threshold for diagonal difference.
                        None means we won't check for this.
    """
    chgcar_data = chgcar.data["total"]
    if (chgcar_data < 0).sum() > 100:
        # a decent bunch of the values are negative this for sure means a broken charge density
        return True
    if diff_thresh:
        """
        If any one diagonal difference accounts for more than a particular portion of
        the total difference between highest and lowest density.
        When we are looking at AECCAR data, since the charge density is so high near the core
        and we have a course grid, this threshold can be as high as 0.99
        """
        diff = chgcar_data[:-1, :-1, :-1] - chgcar_data[1:, 1:, 1:]
        if diff.max() / (chgcar_data.max() - chgcar_data.min()) > diff_thresh:
            return True
    return False