def check_valid_time(time: int, relation_time: int, relation: str) -> bool: if relation == 'ot': return time < relation_time elif relation == 'nt': return time > relation_time elif relation == 'eq': return time == relation_time else: raise ValueError('Invalid relation: {}'.format(relation))