def create_work(usr):
    """
    this method gets information from user and makes instance of
    Work by calling creat work of Work class.
    """
    work_names = [w.work_name for w in usr.works]
    time_format = "%Y-%m-%d %H:%M:%S"
    work_name = ''
    work_datetime = 0
    category = ''
    importance = True
    urgency = True

    while True:
        try:
            work_name = input('title of work:')
            assert work_name not in work_names
            break
        except AssertionError:
            print(f'{Fore.LIGHTRED_EX} work_name already exist in work list{Fore.RESET} ')
            continue

    while True:
        try:
            work_datetime = input('Enter date and time as :(year-month-day hour:min:sec): ')
            assert not re.match(time_format, work_datetime)
            break
        except AssertionError:
            print(f'{Fore.LIGHTRED_EX} wrong date or time format...{Fore.RESET}')
            continue
    while True:
        try:
            importance = input('is this work important? 1. Yes  2. No  ')
            urgency = input('is this work urgent? 1. Yes  2. No  ')
            if importance not in ['1', '2'] or urgency not in ['1', '2']:
                ValueError(importance, urgency)
            importance = True if importance == '1' else False
            urgency = True if urgency == '1' else False
            break

        except ValueError:
            print('invalid input... try again')
            reminder_logger.error(f'invalid input of importance or urgency')
            continue

    try:
        category = input('choose a category for your work: ')
        assert category in usr.categories.keys()
    except AssertionError:
        reminder_logger.info('new category adds to works list')
        pass

    location = input('location of work (optional): ')
    link = input('add a link related to your work (optional): ')
    description = input('enter a description for your work (optional): ')
    notification = input('enter a notification for your work(optional)')

    work_dict = {
        'work_name': work_name,
        'work_datetime': work_datetime,
        'category': category,
        'status': 'in progress',
        'importance': importance,
        'urgency': urgency,
        'location': location,
        'link': link,
        'description': description,
        'notification': notification
    }

    new_work = Work.create_work(work_dict)
    usr.works.append(new_work)
    new_thread = threading.Thread(name=new_work.work_name, target=new_work.notify, daemon=True)
    threads.append(new_thread)
    new_thread.start()

    print(file_manager.write_to_file('all_users_works.json', work_dict, usr.username, work_dict['work_name']))
    reminder_logger.info(f"'{usr.username}' created '{new_work.work_name}' work successfully", exc_info=True)
    return f'"{Fore.LIGHTGREEN_EX}new work was added to work list{Fore.RESET}'