from datetime import datetime


def datetime_from_timestamp(value):
    """
    Produce a :class:`datetime.datetime` from a UTC timestamp.

    This is a registered adapter for both integers and floats.

    >>> from zope.interface.common.idatetime import IDateTime
    >>> from zope.component import provideAdapter
    >>> from nti.externalization.datetime import datetime_from_timestamp
    >>> provideAdapter(datetime_from_timestamp, (int,))
    >>> provideAdapter(datetime_from_timestamp, (float,))
    >>> IDateTime(123456)
    datetime.datetime(1970, 1, 2, 10, 17, 36)
    >>> IDateTime(654321.0)
    datetime.datetime(1970, 1, 8, 13, 45, 21)
    """
    return datetime.utcfromtimestamp(value)