def _get_version(version, debug=False):
if not any(<EOL>(_has_branch(version, debug), _has_tag(version, debug), _has_commit(<EOL>version, debug))):<EOL><INDENT>cmd = sh.git.bake('<STR_LIT>')<EOL>util.run_command(cmd, debug=debug)<EOL><DEDENT>cmd = sh.git.bake('<STR_LIT>', version)<EOL>util.run_command(cmd, debug=debug)<EOL>cmd = sh.git.bake('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>')<EOL>util.run_command(cmd, debug=debug)<EOL>if _has_branch(version, debug):<EOL><INDENT>cmd = sh.git.bake('<STR_LIT>', rebase=True, ff_only=True)<EOL>util.run_command(cmd, debug=debug)<EOL><DEDENT>
Handle switching to the specified version and return None.

1. Fetch the origin.
2. Checkout the specified version.
3. Clean the repository before we begin.
4. Pull the origin when a branch; _not_ a commit id.

:param version: A string containing the branch/tag/sha to be exported.
:param debug: An optional bool to toggle debug output.
:return: None