<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def search_image(name=None, path=['.']):
 """ look for the image real path, if name is None, then return all images under path. @return system encoded path string FIXME(ssx):
 this code is just looking wired. """

    name = strutils.decode(name)
    for image_dir in path:
        if not os.path.isdir(image_dir):
            continue
        image_dir = strutils.decode(image_dir)
        image_path = os.path.join(image_dir, name)
        if os.path.isfile(image_path):
            return strutils.encode(image_path)

        for image_path in list_all_image(image_dir):
            if not image_name_match(name, image_path):
                continue
            return strutils.encode(image_path)
    return None