Arsenal have re-signed midfielder Mathieu Flamini on a free transfer following his departure from AC Milan this summer.