place imports inside the function to avoid import errors when requirements
are not available