import pytz


def to_zulu_string(dt):
  """Returns a Zulu time string from a datetime.

  Assumes naive datetime objects are in UTC.
  Ensures the output always has a floating-point number of seconds.
  """

  # Assume non-tz-aware datetimes are in UTC.
  if dt.tzinfo is None or dt.tzinfo.utcoffset(dt) is None:
    dt = dt.replace(tzinfo=pytz.UTC)

  # Convert datetime into UTC.
  isodate = dt.astimezone(pytz.UTC).isoformat().split('+')[0]

  # Add fractional seconds if not present.
  if '.' not in isodate:
    isodate += '.0'

  return isodate + 'Z'