import os
import sys
try:
    from shutil import which as _which
except ImportError:
    from distutils.spawn import find_executable as _which


def which(binary):
    path = _which(binary)
    if path:
        realpath = os.path.realpath(path)
        return realpath
    return None


def is_python2():
    return sys.version_info < (3,)


class FileNotFoundError(OSError):

    def __init__(self, message="No such file or directory"):
        super(FileNotFoundError, self).__init__(2, message)


class FileExistsError(OSError):

    def __init__(self, message="File exists"):
        super(FileExistsError, self).__init__(17, message)

import os
import sys
try:
    from shutil import which as _which
except ImportError:
    from distutils.spawn import find_executable as _which

try:
  basestring
except NameError:
  basestring = str


def which(binary):
    path = _which(binary)
    if path:
        realpath = os.path.realpath(path)
        return realpath
    return None


def is_python2():
    return sys.version_info < (3,)


class FileNotFoundError(OSError):

    def __init__(self, message="No such file or directory"):
        super(FileNotFoundError, self).__init__(2, message)


class FileExistsError(OSError):

    def __init__(self, message="File exists"):
        super(FileExistsError, self).__init__(17, message)

Add basestring py2/py3 to compat
Add basestring py2/py3 to compat

  import os
  import sys
  try:
      from shutil import which as _which
  except ImportError:
      from distutils.spawn import find_executable as _which
+ 
+ try:
+   basestring
+ except NameError:
+   basestring = str
  
  
  def which(binary):
      path = _which(binary)
      if path:
          realpath = os.path.realpath(path)
          return realpath
      return None
  
  
  def is_python2():
      return sys.version_info < (3,)
  
  
  class FileNotFoundError(OSError):
  
      def __init__(self, message="No such file or directory"):
          super(FileNotFoundError, self).__init__(2, message)
  
  
  class FileExistsError(OSError):
  
      def __init__(self, message="File exists"):
          super(FileExistsError, self).__init__(17, message)
  
Add basestring py2/py3 to compat
## Code Before:
import os
import sys
try:
    from shutil import which as _which
except ImportError:
    from distutils.spawn import find_executable as _which


def which(binary):
    path = _which(binary)
    if path:
        realpath = os.path.realpath(path)
        return realpath
    return None


def is_python2():
    return sys.version_info < (3,)


class FileNotFoundError(OSError):

    def __init__(self, message="No such file or directory"):
        super(FileNotFoundError, self).__init__(2, message)


class FileExistsError(OSError):

    def __init__(self, message="File exists"):
        super(FileExistsError, self).__init__(17, message)

## Instruction:
Add basestring py2/py3 to compat
## Code After:
import os
import sys
try:
    from shutil import which as _which
except ImportError:
    from distutils.spawn import find_executable as _which

try:
  basestring
except NameError:
  basestring = str


def which(binary):
    path = _which(binary)
    if path:
        realpath = os.path.realpath(path)
        return realpath
    return None


def is_python2():
    return sys.version_info < (3,)


class FileNotFoundError(OSError):

    def __init__(self, message="No such file or directory"):
        super(FileNotFoundError, self).__init__(2, message)


class FileExistsError(OSError):

    def __init__(self, message="File exists"):
        super(FileExistsError, self).__init__(17, message)
