code: def apply(self, resource):
          
          if not isinstance(resource, Image.Image):
              raise ValueError('Unknown resource format')
  
          resource_format = resource.format
          resource = resource.rotate(self.angle, expand=True)
          resource.format = resource_format
  
          return resource
docs: Apply filter to resource
          :param resource: Image
          :return: Image