def assign_region_to_channels(channels, anat, parc_type='aparc', max_approx
    =3, exclude_regions=None):
    """Assign a brain region based on the channel location.

    Parameters
    ----------
    channels : instance of sleepytimes.attr.chan.Channels
        channels to assign regions to
    anat : instance of sleepytimes.attr.anat.Freesurfer
        anatomical information taken from freesurfer.
    parc_type : str
        'aparc', 'aparc.a2009s', 'BA', 'BA.thresh', or 'aparc.DKTatlas40'
        'aparc.DKTatlas40' is only for recent freesurfer versions
    max_approx : int, optional
        approximation to define position of the electrode.
    exclude_regions : list of str or empty list
        do not report regions if they contain these substrings. None means
        that it does not exclude any region. For example, to exclude white
        matter regions and unknown regions you can use
        exclude_regions=('White', 'WM', 'Unknown')

    Returns
    -------
    instance of sleepytimes.attr.chan.Channels
        same instance as before, now Chan have attr 'region'
    """
    for one_chan in channels.chan:
        one_region, approx = anat.find_brain_region(one_chan.xyz, parc_type,
            max_approx, exclude_regions)
        one_chan.attr.update({'region': one_region, 'approx': approx})
    return channels
