Notwithstanding anything hereinbefore contained where an accused person has pleaded guilty and has been convicted by a Court of Session or Magistrate of the first class on such plea, there shall be no appeal except as to the extent or legality of the sentence.