code: def _get_access_type(self, mode):
          
          access_type = None
          for char in mode:  # figure out whether it's binary or text access
              if char in 'bt':
                  if access_type is not None:
                      raise IOError('File mode "%s" contains contradictory flags' % mode)
                  access_type = char
              elif char not in 'rbt':
                  raise NotImplementedError(
                          '%s objects are read-only; unsupported mode "%s"'%
                          (type(self), mode))
  
          if access_type is None: access_type = 't'
          return access_type
docs: Make sure mode is appropriate; return 'b' for binary access and 't' for text