<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def goto(directory, create=False):
 """Context object for changing directory. Args: directory (str):
 Directory to go to. create (bool):
 Create directory if it doesn't exists. Usage:: """


    current = os.getcwd()
    directory = os.path.abspath(directory)

    if os.path.isdir(directory) or (create and mkdir(directory)):
        logger.info("goto -> %s", directory)
        os.chdir(directory)
        try:
            yield True
        finally:
            logger.info("goto <- %s", directory)
            os.chdir(current)
    else:
        logger.info(
            "goto(%s) - directory does not exist, or cannot be " "created.",
            directory,
        )
        yield False