def checkLocation(info, location, extrsize, local_find_targ):
    """Check that location and height were specified correctly.

    Parameters
    ----------
    info: dictionary
        Header keywords and values

    location: integer, float, or array_like
        Location(s) at which to extract spectrum or spectra

    extrsize: integer or array_like
        Extraction height (or heights for NUV)

    local_find_targ: dictionary
        The "flag" value in this dictionary may be modified in-place.  If
        location is None, the flag will not be modified.  If location
        was specified, however, the flag will be set to False.  That is,
        if the user specified both a location for the spectrum and that we
        should search for the location, the location takes precedence.

    Returns
    -------
    tuple of two dictionaries
        Dictionary of locations (key is segment or stripe), dictionary of
        extraction heights (key is segment or stripe).  The entries in the
        dictionaries may be None (i.e. if location is None or extrsize is
        None)
    """
    if location is None:
        if info['detector'] == 'FUV':
            location = {info['segment']: None}
        else:
            location = {'NUVA': None, 'NUVB': None, 'NUVC': None}
    else:
        local_find_targ['flag'] = False
        if isinstance(location, int) or isinstance(location, float):
            if info['detector'] == 'FUV':
                location = {info['segment']: location}
            else:
                location = {'NUVA': location, 'NUVB': None, 'NUVC': None}
        else:
            try:
                nelem = len(location)
            except TypeError:
                raise TypeError('location must be an int, float, or sequence')
            if info['detector'] == 'FUV':
                if nelem == 1:
                    location = {info['segment']: location[0]}
                else:
                    raise TypeError(
                        'for FUV, location may have only one element')
            elif info['detector'] == 'NUV':
                if nelem > 3:
                    raise TypeError(
                        'location may not have more than three elements')
                segments = ['NUVA', 'NUVB', 'NUVC']
                temp = {'NUVA': None, 'NUVB': None, 'NUVC': None}
                for i in range(nelem):
                    temp[segments[i]] = location[i]
                location = temp
    if extrsize is None:
        if info['detector'] == 'FUV':
            extrsize = {info['segment']: None}
        else:
            extrsize = {'NUVA': None, 'NUVB': None, 'NUVC': None}
    elif isinstance(extrsize, int):
        if info['detector'] == 'FUV':
            extrsize = {info['segment']: extrsize}
        else:
            extrsize = {'NUVA': extrsize, 'NUVB': extrsize, 'NUVC': extrsize}
    else:
        try:
            nelem = len(extrsize)
        except TypeError:
            raise TypeError('extrsize must be an integer or sequence')
        if info['detector'] == 'FUV':
            if nelem == 1:
                extrsize = {info['segment']: extrsize[0]}
            else:
                raise TypeError('for FUV, extrsize may have only one element')
        elif info['detector'] == 'NUV':
            if nelem == 1:
                extrsize = {'NUVA': extrsize[0], 'NUVB': extrsize[0],
                    'NUVC': extrsize[0]}
            else:
                if nelem > 3:
                    raise TypeError(
                        'extrsize may not have more than three elements')
                segments = ['NUVA', 'NUVB', 'NUVC']
                temp = {'NUVA': None, 'NUVB': None, 'NUVC': None}
                for i in range(nelem):
                    temp[segments[i]] = extrsize[i]
                extrsize = temp
    return location, extrsize
