Optimisation for kw args parsing: static parsing only for required arguments, moved optional arg parsing into a separate function
The idea is that keyword arguments tend to be sparse, so it's faster to iterate over the keyword dictionary and copy keyword values into the named arguments, instead of requesting each optional argument from the keyword dict separately.
This speeds up the case where only required arguments are passed and the case where a minor number of optional keyword arguments are passed (and everything else is passed as positional arguments).