def generator_to_list(generator, max_count=None):
    """
        Convert generator to list
        :param max_count|int: the maximum element count to be joined.
    """
    datas = []
    count = 0
    for r in generator:
        count += 1
        datas.append(r)
        if max_count is not None and count >= max_count:
            break
    return datas