@classmethod
  def utcfromtimestamp(cls, timestamp, allow_future=False):
    """Converts a str or int epoch time to datetime.

    Note: this method drops ms from timestamps.

    Args:
      timestamp: str, int, or float epoch timestamp.
      allow_future: boolean, default False, True to allow future timestamps.
    Returns:
      datetime representation of the timestamp.
    Raises:
      ValueError: timestamp is invalid.
      EpochValueError: the timestamp is valid, but unacceptable.
      EpochFutureValueError: timestamp under an hour in future.
      EpochExtremeFutureValueError: timestamp over an hour in future.
    """
    try:
      timestamp = int(float(timestamp))
      dt = datetime.datetime.utcfromtimestamp(timestamp)
    except (TypeError, __HOLE__):
      raise ValueError(
          'timestamp is None, empty, or otherwise invalid: %s' % timestamp)
    now = datetime.datetime.utcnow()
    if not allow_future and dt > now:
      msg = 'datetime in the future: %s' % dt
      if dt > (now + datetime.timedelta(minutes=66)):
        # raise a slightly different exception for > 66mins to allow for more
        # verbose logging.
        raise EpochExtremeFutureValueError(msg)
      raise EpochFutureValueError(msg)
    return dt
dataset/ETHPy150Open google/simian/src/simian/mac/common/util.py/Datetime.utcfromtimestamp