def parse_spaces(opts):
    """
    Ensure user-defined spatial references for outputs are correctly parsed.

    Certain options require normalization to a space not explicitly defined by users.
    These spaces will not be included in the final outputs.

    """
    spaces = opts.output_spaces
    if not spaces.references and not spaces.is_cached():
        spaces.add('MNI152NLin2009cAsym')
    if not spaces.is_cached():
        spaces.checkpoint()
    if opts.use_aroma:
        spaces.add(('MNI152NLin6Asym', {'res': '2'}))
    if opts.cifti_output:
        vol_res = '2' if opts.cifti_output == '91k' else '1'
        spaces.add(('fsaverage', {'den': '164k'}))
        spaces.add(('MNI152NLin6Asym', {'res': vol_res}))
    if 'MNI152NLin2009cAsym' not in spaces.get_spaces(nonstandard=False,
        dim=(3,)):
        spaces.add('MNI152NLin2009cAsym')
    return spaces
