from typing import List


def generate_gmt_file(output_file: str, gene_sets: List) -> str:
    """
    Generate a GSEA gmt file
    :param output_file: name of output file
    :param gene_sets: list of gene sets; each entry is (gene_set_name, gene_set_origin, list of gene symbols)
    :return:
    """
    with open(output_file, 'w') as f:
        for gs_name, gs_origin, symbols in gene_sets:
            f.write('{}\t{}\t{}\n'.format(
                gs_name,
                gs_origin,
                '\t'.join(symbols)
            ))
    return output_file