code: def remove_dirs(sudo):
      print("Removing old build and distribution directories...")
      print(
          """The distribution is built as root, so the files have the correct
      permissions when installed by the user.  Chown them to user for removal."""
      )
      if os.path.exists(BUILD_DIR):
          cmd = f"chown -R {getuser()} {BUILD_DIR}"
          if sudo:
              cmd = f"sudo {cmd}"
          shellcmd(cmd)
          shutil.rmtree(BUILD_DIR)
      if os.path.exists(DIST_DIR):
          cmd = f"sudo chown -R {getuser()} {DIST_DIR}"
          if sudo:
              cmd = f"sudo {cmd}"
          shellcmd(cmd)
          shutil.rmtree(DIST_DIR)
  
file_path: dipy/tools/osxbuild.py
imports: import os
  import sys
  import shutil
  import subprocess
  from optparse import OptionParser
  from getpass import getuser
label_desc: Use image node_id 1 for calling a global function with example usage: remove_dirs(sudo) without return types