<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_time(value, ctx):
 """ Tries conversion of any value to a time """

    if isinstance(value, str):
        time = ctx.get_date_parser().time(value)
        if time is not None:
            return time
    elif isinstance(value, datetime.time):
        return value
    elif isinstance(value, datetime.datetime):
        return value.astimezone(ctx.timezone).time()

    raise EvaluationError("Can't convert '%s' to a time" % str(value))