def is_flat(neurite, tol, method='<STR_LIT>'):
ext = principal_direction_extent(neurite.points[:, COLS.XYZ])<EOL>assert method in ('<STR_LIT>', '<STR_LIT>'), "<STR_LIT>"<EOL>if method == '<STR_LIT>':<EOL><INDENT>sorted_ext = np.sort(ext)<EOL>return sorted_ext[<NUM_LIT:0>] / sorted_ext[<NUM_LIT:1>] < float(tol)<EOL><DEDENT>return any(ext < float(tol))<EOL>
Check if neurite is flat using the given method

    Args:
        neurite(Neurite): neurite to operate on
        tol(float): tolerance
        method(string): the method of flatness estimation:
            'tolerance' returns true if any extent of the tree is smaller
            than the given tolerance
            'ratio' returns true if the ratio of the smallest directions
            is smaller than tol. e.g. [1,2,3] -> 1/2 < tol

    Returns:
        True if neurite is flat