<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def imread(path, grayscale=False, size=None, interpolate="bilinear", channel_first=False, as_uint16=False, num_channels=-1):
 """ Read image by pypng module. Args: path (str or 'file object'):
 File path or object to read. grayscale (bool):
 size (tupple of int):
 (width, height). If None, output img shape depends on the files to read. channel_first (bool):
 This argument specifies the shape of img is whether (height, width, channel) or (channel, height, width). Default value is False, which means the img shape is (height, width, channel). interpolate (str):
 must be one of ["nearest", "box", "bilinear", "hamming", "bicubic", "lanczos"]. as_uint16 (bool):
 If True, this function reads image as uint16. num_channels (int):
 channel size of output array. Default is -1 which preserves raw image shape. Returns: numpy.ndarray """


    _imread_before(grayscale, num_channels)

    f = path if hasattr(path, "read") else open(path, "rb")

    r = png.Reader(file=f)
    width, height, pixels, metadata = r.asDirect()

    bit_depth = metadata.get("bitdepth")

    if bit_depth not in [8, 16]:
        raise ValueError("The bit-depth of the image you want to read is unsupported ({}bit)."
                         "Currently, pypng backend`s imread supports only [8, 16] bit-depth."
                         "the path for this image is {}".format(bit_depth, path))

    img = read_result_to_ndarray(
        pixels, width, height, metadata, grayscale, as_uint16, num_channels)

    return _imread_after(img, size, interpolate, channel_first, imresize)