
from __future__ import absolute_import, division, print_function, unicode_literals
import sys

unicode = type("")

class BytesOnly(bytes):
    def __new__(cls, s):
        if isinstance(s, unicode):
            s = s.encode()
        return bytes.__new__(BytesOnly, s)

    def __eq__(self, o):
        return isinstance(o, bytes) and bytes.__eq__(self, o)

    def __ne__(self, o):
        return not self == o

class UnicodeOnly(unicode):
    def __eq__(self, o):
        return isinstance(o, unicode) and unicode.__eq__(self, o)

    def __ne__(self, o):
        return not self == o

if sys.version_info >= (3,):
    LongOnly = int
else:
    class LongOnly(long):
        def __eq__(self, o):
            return isinstance(o, long) and long.__cmp__(self, o) == 0

    def __ne__(self, o):
        return not self == o


from __future__ import absolute_import, division, print_function, unicode_literals


unicode = type("")

class BytesOnly(bytes):
    def __new__(cls, s):
        if isinstance(s, unicode):
            s = s.encode()
        return bytes.__new__(BytesOnly, s)

    def __eq__(self, o):
        return isinstance(o, bytes) and bytes.__eq__(self, o)

    def __ne__(self, o):
        return not self == o

class UnicodeOnly(unicode):
    def __eq__(self, o):
        return isinstance(o, unicode) and unicode.__eq__(self, o)

    def __ne__(self, o):
        return not self == o

try:
    class LongOnly(long):  # Python 2
        def __eq__(self, o):
            return isinstance(o, long) and long.__cmp__(self, o) == 0

        def __ne__(self, o):
            return not self == o
except NameError:          # Python 3
    LongOnly = int

Fix indentation error in LongOnly.__ne__()
Fix indentation error in LongOnly.__ne__()

Also follow Python porting best practice [__use feature detection instead of version detection__](https://docs.python.org/3/howto/pyporting.html#use-feature-detection-instead-of-version-detection).
  
  from __future__ import absolute_import, division, print_function, unicode_literals
- import sys
+ 
  
  unicode = type("")
  
  class BytesOnly(bytes):
      def __new__(cls, s):
          if isinstance(s, unicode):
              s = s.encode()
          return bytes.__new__(BytesOnly, s)
  
      def __eq__(self, o):
          return isinstance(o, bytes) and bytes.__eq__(self, o)
  
      def __ne__(self, o):
          return not self == o
  
  class UnicodeOnly(unicode):
      def __eq__(self, o):
          return isinstance(o, unicode) and unicode.__eq__(self, o)
  
      def __ne__(self, o):
          return not self == o
  
+ try:
- if sys.version_info >= (3,):
-     LongOnly = int
- else:
-     class LongOnly(long):
+     class LongOnly(long):  # Python 2
          def __eq__(self, o):
              return isinstance(o, long) and long.__cmp__(self, o) == 0
  
-     def __ne__(self, o):
+         def __ne__(self, o):
-         return not self == o
+             return not self == o
+ except NameError:          # Python 3
+     LongOnly = int
  
Fix indentation error in LongOnly.__ne__()
## Code Before:

from __future__ import absolute_import, division, print_function, unicode_literals
import sys

unicode = type("")

class BytesOnly(bytes):
    def __new__(cls, s):
        if isinstance(s, unicode):
            s = s.encode()
        return bytes.__new__(BytesOnly, s)

    def __eq__(self, o):
        return isinstance(o, bytes) and bytes.__eq__(self, o)

    def __ne__(self, o):
        return not self == o

class UnicodeOnly(unicode):
    def __eq__(self, o):
        return isinstance(o, unicode) and unicode.__eq__(self, o)

    def __ne__(self, o):
        return not self == o

if sys.version_info >= (3,):
    LongOnly = int
else:
    class LongOnly(long):
        def __eq__(self, o):
            return isinstance(o, long) and long.__cmp__(self, o) == 0

    def __ne__(self, o):
        return not self == o

## Instruction:
Fix indentation error in LongOnly.__ne__()
## Code After:

from __future__ import absolute_import, division, print_function, unicode_literals


unicode = type("")

class BytesOnly(bytes):
    def __new__(cls, s):
        if isinstance(s, unicode):
            s = s.encode()
        return bytes.__new__(BytesOnly, s)

    def __eq__(self, o):
        return isinstance(o, bytes) and bytes.__eq__(self, o)

    def __ne__(self, o):
        return not self == o

class UnicodeOnly(unicode):
    def __eq__(self, o):
        return isinstance(o, unicode) and unicode.__eq__(self, o)

    def __ne__(self, o):
        return not self == o

try:
    class LongOnly(long):  # Python 2
        def __eq__(self, o):
            return isinstance(o, long) and long.__cmp__(self, o) == 0

        def __ne__(self, o):
            return not self == o
except NameError:          # Python 3
    LongOnly = int
