Write specific function
Write a function in [LINGUAGEM] that does the following: [DESCRIÇÃO DA FUNCIONALIDADE]. Inputs: [ENTRADAS]. Expected output: [SAÍDA]. Include edge case handling, explanatory comments and a usage example. Follow the best practices of the language.