def _make_method(name, script, filename, globs):
    """
    Create the method with the script given and return the method object.
    """
    locs = {}

    # In order of debuggers like PDB being able to step through the code,
    # we add a fake linecache entry.
    count = 1
    base_filename = filename
    while True:
        linecache_tuple = (
            len(script),
            None,
            script.splitlines(True),
            filename,
        )
        old_val = linecache.cache.setdefault(filename, linecache_tuple)
        if old_val == linecache_tuple:
            break
        else:
            filename = f"{base_filename[:-1]}-{count}>"
            count += 1

    _compile_and_eval(script, globs, locs, filename)

    return locs[name]

    Create the method with the script given and return the method object.
    
product/gradle-plugin/src/main/python/attr/_make.py