def create_row(username, results, release_count):
    """
    Returns string with format UserName,M1,M2,...,Mn.
    :param username: string
    :param results: queryset object
    :param release_count: int
    :return: Formatted string
    """
    row = "{}".format(username)

    count = 1
    while count <= release_count:
        result = results.filter(comment__release=count).first()

        if result:
            row += ",{}".format(result.mark)
        else:
            row += ",0"
        count += 1

    return row