You right, but this code snippet used also in mitmproxy.rb and ansible.rb.
I assumed if we duplicate functionality then we at least should make identical, in case later it will unified.