Former French president Nicolas Sarkozy has been freed from prison, less than three weeks after he began serving a five-year sentence for conspiracy.