It's World Book Night. And my 400th post here. And my 300th post there.
Borrowing from Shakespeare is a noble SF tradition, and of course Doctor Who has gone right to the source.
Borrowing from Cervantes somewhat less so, as discussed over thataway, although an "it seems the fantasy hero is actually deluded" episode would certainly be possible with the Doctor or other travellers in time and space. (The Doctor in an asylum suffering amnesia was the plot of one of the unmade Who movies.) A Celebrity Historical in which Cervantes confronts windmill-shaped alien war machines would be a bit much, I think.