Component development: Get last_update time of entity

How to I retrieve the last update time of an entity in Python?
I’m trying to customize a component to check if the entity has been updated for the last X seconds.

If you have the entity ID in a variable named entity_id, then:

state = hass.states.get(entity_id)
if state:
    last_updated = state.last_updated

Since it’s a component I don’t have the variable name itself.
Can it be used with ‘self’ ?

Like so:

state = hass.states.get(self)
if state:
    last_updated = state.last_updated

Figured something out myself:

state = self.hass.states.get("sensor." + self.name)

this returns a collection of available states.
To get the update_time specific, use:

last_update_state = state.last_updated

If what you’re writing is a sensor, then shouldn’t you be writing a sensor platform instead of a component?