cd to target dir when running in this block

    :param cd_path: dir to cd into
    :param create: create new dir if destination not there

    Usage::

        >>> with cd("/tmp"):
        ...     print("we are in /tmp now")

def cd(cd_path, create=False):
    """cd to target dir when running in this block

    :param cd_path: dir to cd into
    :param create: create new dir if destination not there

    Usage::

        >>> with cd("/tmp"):
        ...     print("we are in /tmp now")
    """
    oricwd = os.getcwd()
    if create:
        mkdir(cd_path)
    try:
        os.chdir(cd_path)
        yield
    finally:
        os.chdir(oricwd)