I'm not sure what would be the best solution here, you could customize the code so that if it is over 20kg you just set it to the max value, like 19990 grams. If it is under this value then just use the value directly.
Would this solve the problem for you? If you have items to be sent that exceed the total that your provider will allow this can be a tricky thing to overcome. Please post back with some more info on this and what would be an acceptable solution for the problem and I will help you out with what I can.