def convert_to_csv(records):
    """Convert records in list type to csv string.

    Args:
        records: A list of power data records each of which contains timestamp, power value,
        and channel. e.g. [[12345678, 80, "SYSTEM"],[23456789, 60, "SENSOR"]].

    Returns:
        A string that contains all CSV records, None if the given list if empty.
    """
    if not records:
        return ''

    csv_lines = list()
    for record in records:
        string_record = [str(element) for element in record]
        csv_line = ','.join(string_record)
        csv_lines.append(csv_line)

    return '\n'.join(csv_lines)