def create_update_gitdir():
    if not os.path.exists(gitdname):
        retcode = subprocess.call('git clone '+repo, shell=True,
                                  stdout=sys.stdout, stderr=sys.stderr)
        if retcode != 0:
            msg = """There was a problem cloning the repo"""
            raise Exception(msg)
    else:  # directory exists, can't pull if you're not on a branch
           # just delete it and clone again. Lazy but clean solution.
        shutil.rmtree(gitdname)
        create_update_gitdir()
Creates a directory for local repo if it doesn't exist,
dataset/ETHPy150Open statsmodels/statsmodels/tools/update_web.py/create_update_gitdir