def get_datetime(index_timestamp, timestring):
    """
    Return the datetime extracted from the index name, which is the index
    creation time.

    :arg index_timestamp: The timestamp extracted from an index name
    :arg timestring: An strftime pattern
    :rtype: :py:class:`datetime.datetime`
    """
    # Compensate for week of year by appending '%w' to the timestring
    # and '1' (Monday) to index_timestamp
    if timestring in '%W':
        timestring += '%w'
        index_timestamp += '1'
    elif '%U' in timestring:
        timestring += '%w'
        index_timestamp += '1'
    elif '%m' in timestring:
        if not '%d' in timestring:
            timestring += '%d'
            index_timestamp += '1'
    # logger.debug(
    #     'index_timestamp: {0}, timestring: {1}, return value: '
    #     '{2}'.format(
    #         index_timestamp, timestring,
    #         datetime.strptime(index_timestamp, timestring)
    #     )
    # )
    return datetime.strptime(index_timestamp, timestring)
dataset/ETHPy150Open elastic/curator/curator/utils.py/get_datetime/swapped operands of `in`