human
Complete this python program:
def find_definition(project, code, offset, resource=None, maxfixes=1):
assistant
#Here is the Python code you requested.

    """Return the definition location of the python name at `offset`
    A `Location` object is returned if the definition location can be
    determined, otherwise ``None`` is returned.
    """
    fixer = fixsyntax.FixSyntax(project, code, resource, maxfixes)
    pyname = fixer.pyname_at(offset)
    if (pyname is not None):
        (module, lineno) = pyname.get_definition_location()
        name = rope.base.worder.Worder(code).get_word_at(offset)
        if (lineno is not None):
            start = module.lines.get_line_start(lineno)
            def check_offset(occurrence):
                if (occurrence.offset < start):
                    return False
            pyname_filter = occurrences.PyNameFilter(pyname)
            finder = occurrences.Finder(project, name, [check_offset, pyname_filter])
            for occurrence in finder.find_occurrences(pymodule=module):
                return Location(occurrence)