A function to compute ages

Having unit = "string" is semantically incorrect and confusing. This is a return type controlling parameter, a style which is thrown upon in general programming practice.   I personally would avoid it altogether. Besides that, the output is really a period object and not a string.