human
I wrote the below code

    def pilread(fname):
        u'try    to    load    the    image    with    PIL    or    return    None'
        try:
            from PIL import Image
        except ImportError:
            return None
        with Image.open(fname) as image:
            return pil_to_array(image)
    handlers = {u'png': _png.read_png}
    if (format is None):
        if isinstance(fname, six.string_types):
            parsed = urlparse(fname)
            if (len(parsed.scheme) > 1):
                ext = u'png'
            else:
                (basename, ext) = os.path.splitext(fname)
                ext = ext.lower()[1:]
        elif hasattr(fname, u'name'):
            (basename, ext) = os.path.splitext(fname.name)
            ext = ext.lower()[1:]
        else:
            ext = u'png'
    else:
        ext = format
    if (ext not in handlers):
        im = pilread(fname)
        if (im is None):
            raise ValueError((u'Only    know    how    to    handle    extensions:    %s.
   with    Pillow    installed    matplotlib    can    handle    more    images' % list(handlers)))
        return im
    handler = handlers[ext]
    if isinstance(fname, six.string_types):
        parsed = urlparse(fname)
        if (len(parsed.scheme) > 1):
            fd = BytesIO(urlopen(fname).read())
            return handler(fd)
        else:
            with open(fname, u'rb') as fd:
                return handler(fd)
    else:
        return handler(fname)

What's a good function header?
assistant
#Here's a good function header.

def imread(fname, format=None):