class BaseGrader(object):
    def __init__(self, judge, problem, language, source):
        self.source = source
        self.language = language
        self.problem = problem
        self.judge = judge
        self.binary = self._generate_binary()
        self._terminate_grading = False
        self._current_proc = None

    def grade(self, case):
        raise NotImplementedError

    def _generate_binary(self):
        raise NotImplementedError

    def terminate_grading(self):
        self._terminate_grading = True
        if self._current_proc:
            try:
                self._current_proc.kill()
            except OSError:
                pass
        pass

class BaseGrader(object):
    def __init__(self, judge, problem, language, source):
        if isinstance(source, unicode):
            source = source.encode('utf-8')
        self.source = source
        self.language = language
        self.problem = problem
        self.judge = judge
        self.binary = self._generate_binary()
        self._terminate_grading = False
        self._current_proc = None

    def grade(self, case):
        raise NotImplementedError

    def _generate_binary(self):
        raise NotImplementedError

    def terminate_grading(self):
        self._terminate_grading = True
        if self._current_proc:
            try:
                self._current_proc.kill()
            except OSError:
                pass
        pass

Make source utf-8 encoded bytes.
Make source utf-8 encoded bytes.

  class BaseGrader(object):
      def __init__(self, judge, problem, language, source):
+         if isinstance(source, unicode):
+             source = source.encode('utf-8')
          self.source = source
          self.language = language
          self.problem = problem
          self.judge = judge
          self.binary = self._generate_binary()
          self._terminate_grading = False
          self._current_proc = None
  
      def grade(self, case):
          raise NotImplementedError
  
      def _generate_binary(self):
          raise NotImplementedError
  
      def terminate_grading(self):
          self._terminate_grading = True
          if self._current_proc:
              try:
                  self._current_proc.kill()
              except OSError:
                  pass
          pass
  
Make source utf-8 encoded bytes.
## Code Before:
class BaseGrader(object):
    def __init__(self, judge, problem, language, source):
        self.source = source
        self.language = language
        self.problem = problem
        self.judge = judge
        self.binary = self._generate_binary()
        self._terminate_grading = False
        self._current_proc = None

    def grade(self, case):
        raise NotImplementedError

    def _generate_binary(self):
        raise NotImplementedError

    def terminate_grading(self):
        self._terminate_grading = True
        if self._current_proc:
            try:
                self._current_proc.kill()
            except OSError:
                pass
        pass

## Instruction:
Make source utf-8 encoded bytes.
## Code After:
class BaseGrader(object):
    def __init__(self, judge, problem, language, source):
        if isinstance(source, unicode):
            source = source.encode('utf-8')
        self.source = source
        self.language = language
        self.problem = problem
        self.judge = judge
        self.binary = self._generate_binary()
        self._terminate_grading = False
        self._current_proc = None

    def grade(self, case):
        raise NotImplementedError

    def _generate_binary(self):
        raise NotImplementedError

    def terminate_grading(self):
        self._terminate_grading = True
        if self._current_proc:
            try:
                self._current_proc.kill()
            except OSError:
                pass
        pass
