def get_version(version=None):
if version is None:<EOL><INDENT>version = VERSION<EOL><DEDENT>assert len(version) == <NUM_LIT:5><EOL>assert version[<NUM_LIT:3>] in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>')<EOL>parts = <NUM_LIT:2> if version[<NUM_LIT:2>] == <NUM_LIT:0> else <NUM_LIT:3><EOL>main = '<STR_LIT:.>'.join(str(x) for x in version[:parts])<EOL>sub = '<STR_LIT>'<EOL>if version[<NUM_LIT:3>] == '<STR_LIT>' and version[<NUM_LIT:4>] == <NUM_LIT:0>:<EOL><INDENT>from django.utils.version import get_svn_revision<EOL>svn_revision = get_svn_revision()[<NUM_LIT:4>:]<EOL>if svn_revision != '<STR_LIT>':<EOL><INDENT>sub = '<STR_LIT>' % svn_revision<EOL><DEDENT><DEDENT>elif version[<NUM_LIT:3>] != '<STR_LIT>':<EOL><INDENT>mapping = {'<STR_LIT>': '<STR_LIT:a>', '<STR_LIT>': '<STR_LIT:b>', '<STR_LIT>': '<STR_LIT:c>'}<EOL>sub = mapping[version[<NUM_LIT:3>]] + str(version[<NUM_LIT:4>])<EOL><DEDENT>return main + sub<EOL>
Derives a PEP386-compliant version number from VERSION.