<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_from_png(cls, source):
 """Decode a PNG file into a new image surface. :param source: A filename or a binary mode file-like object with a :meth:`~file.read` method. If you already have a byte string in memory, use :class:`io.BytesIO`. :returns: A new :class:`ImageSurface` instance. """

        if hasattr(source, 'read'):
            read_func = _make_read_func(source)
            pointer = cairo.cairo_image_surface_create_from_png_stream(
                read_func, ffi.NULL)
        else:
            pointer = cairo.cairo_image_surface_create_from_png(
                _encode_filename(source))
        self = object.__new__(cls)
        Surface.__init__(self, pointer)  # Skip ImageSurface.__init__
        return self