def split_filename(filename, project_name=None):
result = None<EOL>pyver = None<EOL>m = PYTHON_VERSION.search(filename)<EOL>if m:<EOL><INDENT>pyver = m.group(<NUM_LIT:1>)<EOL>filename = filename[:m.start()]<EOL><DEDENT>if project_name and len(filename) > len(project_name) + <NUM_LIT:1>:<EOL><INDENT>m = re.match(re.escape(project_name) + r'<STR_LIT>', filename)<EOL>if m:<EOL><INDENT>n = m.end()<EOL>result = filename[:n], filename[n + <NUM_LIT:1>:], pyver<EOL><DEDENT><DEDENT>if result is None:<EOL><INDENT>m = PROJECT_NAME_AND_VERSION.match(filename)<EOL>if m:<EOL><INDENT>result = m.group(<NUM_LIT:1>), m.group(<NUM_LIT:3>), pyver<EOL><DEDENT><DEDENT>return result<EOL>
Extract name, version, python version from a filename (no extension)

Return name, version, pyver or None