def get_entry(ts, entryid):
    entries = ts.entries()
    try:
        id = int(entryid)
    except __HOLE__:
        # the entry is not an ID.
        regex = re.compile(entryid, flags = re.IGNORECASE)
        matches = []
        for entry in entries:
            if regex.search(entry.task_name):
                matches += [entry]
        if len(matches) is 1:
            return matches[0]
        elif len(matches) >= 2:
            print 'More than one match found. Narrow your search.'
            return None
    else:
        # the entry is an ID.
        for entry in entries:
            if entry.id == id:
                return entry
dataset/ETHPy150Open jakebasile/reap/reap/commands/basic.py/get_entry