def find_file(folder, filename):
    """
    Find a file given folder and filename. If the filename can be
    resolved directly returns otherwise walks the supplied folder.
    """
    matches = []
    if os.path.isabs(filename) and os.path.isfile(filename):
        return filename
    for root, _, filenames in os.walk(folder):
        for fn in fnmatch.filter(filenames, filename):
            matches.append(os.path.join(root, fn))
    if not matches:
        raise IOError('File %s could not be found' % filename)
    return matches[-1]