<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _detect_encoding(self, source_file):
 """Detect encoding."""


        encoding = self._guess(source_file)
        # If we didn't explicitly detect an encoding, assume default.
        if encoding is None:
            encoding = self.default_encoding

        return encoding