def update_lifecycle_test_tags(lifecycle, test, tags):
    """Returns lifecycle object after creating or updating the tags for 'test'."""
    if not lifecycle["selector"]["js_test"]:
        lifecycle["selector"]["js_test"] = {test: tags}
    else:
        lifecycle["selector"]["js_test"][test] = tags
    return lifecycle