<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_surface(renderer, surface):
 """Create a texture from an existing surface. Args: surface (Surface):
 The surface containing pixel data used to fill the texture. Returns: Texture: A texture containing the pixels from surface. Raises: SDLError: If an error is encountered. """

        texture = object.__new__(Texture)
        texture._ptr = check_ptr_err(lib.SDL_CreateTextureFromSurface(renderer._ptr, surface._ptr))
        return texture