Removed duplicated code

Created an AbstractBaseStream, which is implementation agnostic, and
BaseStream, which is tied to pyuv streams, and put shared functionality
there.