def generate_tld_cols(hostname_split_df, hostnames, col_len):
    """
    This function generates tld columns.

    :param hostname_split_df: Hostname splits.
    :type hostname_split_df: cudf.DataFrame
    :param hostnames: Hostnames.
    :type hostnames: cudf.DataFrame
    :param col_len: Hostname splits dataframe columns length.
    :return: Tld columns with all combination.
    :rtype: cudf.DataFrame

    Examples
    --------
    >>> import cudf
    >>> from clx.dns import dns_extractor as dns
    >>> hostnames = cudf.Series(["www.google.com", "pandas.pydata.org"])
    >>> hostname_splits = dns.get_hostname_split_df(hostnames)
    >>> print(hostname_splits)
         2       1       0
    0  com  google     www
    1  org  pydata  pandas
    >>> col_len = len(hostname_split_df.columns) - 1
    >>> col_len = len(hostname_splits.columns) - 1
    >>> dns.generate_tld_cols(hostname_splits, hostnames, col_len)
         2       1       0 tld2        tld1               tld0
    0  com  google     www  com  google.com     www.google.com
    1  org  pydata  pandas  org  pydata.org  pandas.pydata.org
    """
    hostname_split_df = hostname_split_df.fillna("")
    hostname_split_df["tld" + str(col_len)] = hostname_split_df[col_len]
    # Add all other elements of hostname_split_df
    for j in range(col_len - 1, 0, -1):
        hostname_split_df["tld" + str(j)] = (
            hostname_split_df[j]
            .str.cat(hostname_split_df["tld" + str(j + 1)], sep=".")
            .str.rstrip(".")
        )
    # Assign hostname to tld0, to handle received input is just domain name.
    hostname_split_df["tld0"] = hostnames
    return hostname_split_df