Sanitizes function arguments by specified types. Also allows for optional arguments.