def guesstype(timestr):
    """Tries to guess whether a string represents a time or a time delta and
    returns the appropriate object.

    :param timestr (required)
        The string to be analyzed
    """
    timestr_full = " {} ".format(timestr)
    if timestr_full.find(" in ") != -1 or timestr_full.find(" ago ") != -1:
        return Chronyk(timestr)

    comps = ["second", "minute", "hour", "day", "week", "month", "year"]
    for comp in comps:
        if timestr_full.find(comp) != -1:
            return ChronykDelta(timestr)

    return Chronyk(timestr)
dataset/ETHPy150Open KoffeinFlummi/Chronyk/chronyk/chronyk.py/guesstype/original