Generalized Hestenes’ Lemma and extension of functions