def binlogs_to_backup(cursor, last_binlog=None):
    """
    Finds list of binlogs to copy. It will return the binlogs
    from the last to the current one (excluding it).

    :param cursor: MySQL cursor
    :param last_binlog: Name of the last copied binlog.
    :return: list of binlogs to backup.
    :rtype: list
    """
    binlogs = []
    cursor.execute("SHOW BINARY LOGS")
    for row in cursor.fetchall():
        binlog = row['Log_name']
        if not last_binlog or binlog > last_binlog:
            binlogs.append(binlog)

    return binlogs[:-1]