<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_local_path(directory, create_dir=False):
 """ sets path for local saving of information if create is true we will create the folder even if it doesnt exist """

    if not os.path.exists(directory) and create_dir is True:
        os.makedirs(directory)

    if not os.path.exists(directory) and create_dir is False:
        raise AttributeError("Path '%s' does not exist, to make it pass create_dir=True to rinocloud.set_local_path" % directory)

    if os.path.isdir(directory):
        rinocloud.path = directory

    return directory