code: def set_thumbnail(self, thumbnail):
          
          headers = {
              "Authorization": "token {}".format(self._client.token),
              "Content-type": "image/png",
          }
  
          # TODO this check needs to be smarter - python2 doesn't do it right
          if not isinstance(thumbnail, bytes):
              with open(thumbnail, 'rb') as f:
                  thumbnail = f.read()
  
          result = requests.put('{}/{}/thumbnail'.format(self._client.base_url,
                  OAuthClient.api_endpoint.format(id=self.id)),
                  headers=headers, data=thumbnail)
  
          if not result.status_code == 200:
              errors = []
              j = result.json()
              if 'errors' in j:
                  errors = [ e['reason'] for e in j['errors'] ]
              raise ApiError('{}: {}'.format(result.status_code, errors), json=j)
  
          return True
docs: Sets the thumbnail for this OAuth Client.  If thumbnail is bytes,
          uploads it as a png.  Otherwise, assumes thumbnail is a path to the
          thumbnail and reads it in as bytes before uploading.