def flagged_return(flags, objects):
    """Return only objects with corresponding True flags. Useful for functions with multiple possible return items."""
    if sum(flags) == 1:
        return objects[0]
    elif sum(flags) > 1:
        return tuple([object for flag, object in zip(flags, objects) if flag])
    else:
        return ()