<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def time_context_from_timex(timex):
 """Return a TimeContext object given a timex entry."""

    time_text = timex.get('text')
    constraint = timex['intervals'][0]
    start = _get_time_stamp(constraint.get('start'))
    end = _get_time_stamp(constraint.get('end'))
    duration = constraint['duration']
    tc = TimeContext(text=time_text, start=start, end=end,
                     duration=duration)
    return tc