def from_timestamp(timestamp):
 try:
  return datetime.utcfromtimestamp(int(timestamp)).replace(tzinfo=utc)
 except (ValueError, TypeError):
  return None

def from_timestamp ( timestamp ) : try : return datetime . utcfromtimestamp ( int ( timestamp ) ) . replace ( tzinfo = utc ) except ( ValueError , TypeError ) : return None
convert a timestamp into a timezone-aware datetime .