Copy and adapt file from django-xmlrpc.

Change-Id: I5cdbc410392a95828213bd23bee552cf26bcbd9a