def METHOD_NAME(self):
    if self._cipher_key or self._pubnub.config.cipher_key:
        try:
            payload = self._file_object.read()
        except AttributeError:
            payload = self._file_object
        return PubNubFileCrypto(self._pubnub.config).encrypt(
            self._cipher_key or self._pubnub.config.cipher_key,
            payload
        )
    else:
        return self._file_object