def set_only_stages(config, stages):
    """Overwrides individual stages if --only option has been specified. 
    
    Args
       config -- the configuration dictionary
       stages -- a list of registered stages"""
    
    # modify a copy, probably best practice rather than 
    # modifying the original. 
    
    result = config.copy()
    only = config.get('only')

    if type(only)==type(""): only=[only]

    # set all other stages to false
    for stage in stages:
        result[stage] = False
    
    for stage in only:
        if stage in stages:
            result[stage] = True
                
    return result