add option for remote urls, conditionally write directly to stdout for python versions earlier than 3