def _get_or_create_tag_meta(project_id, tag_meta):
    for get_from_server_flag in [False, True]:
        project_meta = get_meta(project_id, from_server=get_from_server_flag)
        project_tag_meta: sly.TagMeta = project_meta.get_tag_meta(tag_meta.name)
        sly.logger.info(f'_get_or_create_tag_meta: project_tag_meta is None={(project_tag_meta is None)!r}, get_from_server_flag={get_from_server_flag!r}')
        if (project_tag_meta is not None):
            break
    if (project_tag_meta is None):
        project_meta = project_meta.add_tag_meta(tag_meta)
        update_project_meta(project_id, project_meta)
        project_meta = get_meta(project_id, from_server=True)
        project_tag_meta = project_meta.get_tag_meta(tag_meta.name)
    return project_tag_meta
def _get_or_create_tag_meta(project_id, tag_meta):
    for get_from_server_flag in [False, True]:
        project_meta = get_meta(project_id, from_server=get_from_server_flag)
        project_tag_meta: sly.TagMeta = project_meta.get_tag_meta(tag_meta.name)
        sly.logger.info(f'_get_or_create_tag_meta: project_tag_meta is None={(project_tag_meta is None)!r}, get_from_server_flag={get_from_server_flag!r}')
        if (project_tag_meta is not None):
            break
    if (project_tag_meta is None):
        project_meta = project_meta.add_tag_meta(tag_meta)
        update_project_meta(project_id, project_meta)
        project_meta = get_meta(project_id, from_server=True)
        project_tag_meta = project_meta.get_tag_meta(tag_meta.name)
    return project_tag_meta