'Create a timestamp spec from a timestamp value.
Args:
timestamp: A range of times for consideration (In
microseconds). Can be a constant such as ALL_TIMESTAMPS or
NEWEST_TIMESTAMP or a tuple of ints (start, end).
Returns:
An rdfvalue.TimestampSpec() instance.'

def TimestampSpecFromTimestamp(self, timestamp):

    if (timestamp is None):
        all_ts = rdf_data_store.TimestampSpec.Type.ALL_TIMESTAMPS
        return rdf_data_store.TimestampSpec(type=all_ts)
    if (timestamp in (rdf_data_store.TimestampSpec.Type.ALL_TIMESTAMPS, rdf_data_store.TimestampSpec.Type.NEWEST_TIMESTAMP)):
        return rdf_data_store.TimestampSpec(type=timestamp)
    if (timestamp == self.NEWEST_TIMESTAMP):
        newest = rdf_data_store.TimestampSpec.Type.NEWEST_TIMESTAMP
        return rdf_data_store.TimestampSpec(type=newest)
    if isinstance(timestamp, (list, tuple)):
        (start, end) = timestamp
        return rdf_data_store.TimestampSpec(start=start, end=end, type=rdf_data_store.TimestampSpec.Type.RANGED_TIME)
    return rdf_data_store.TimestampSpec(start=timestamp, type=rdf_data_store.TimestampSpec.Type.SPECIFIC_TIME)
