# Path: telethon/_misc/helpers.py
# def pretty_print(obj, indent=None, max_depth=float('inf')):
#     max_depth -= 1
#     if max_depth < 0:
#         return '...'
# 
#     to_d = getattr(obj, 'to_dict', None)
#     if callable(to_d):
#         obj = to_d()
# 
#     if indent is None:
#         if isinstance(obj, dict):
#             return '{}({})'.format(obj.get('_', 'dict'), ', '.join(
#                 '{}={}'.format(k, pretty_print(v, indent, max_depth))
#                 for k, v in obj.items() if k != '_'
#             ))
#         elif isinstance(obj, str) or isinstance(obj, bytes):
#             return repr(obj)
#         elif hasattr(obj, '__iter__'):
#             return '[{}]'.format(
#                 ', '.join(pretty_print(x, indent, max_depth) for x in obj)
#             )
#         else:
#             return repr(obj)
#     else:
#         result = []
# 
#         if isinstance(obj, dict):
#             result.append(obj.get('_', 'dict'))
#             result.append('(')
#             if obj:
#                 result.append('\n')
#                 indent += 1
#                 for k, v in obj.items():
#                     if k == '_':
#                         continue
#                     result.append('\t' * indent)
#                     result.append(k)
#                     result.append('=')
#                     result.append(pretty_print(v, indent, max_depth))
#                     result.append(',\n')
#                 result.pop()  # last ',\n'
#                 indent -= 1
#                 result.append('\n')
#                 result.append('\t' * indent)
#             result.append(')')
# 
#         elif isinstance(obj, str) or isinstance(obj, bytes):
#             result.append(repr(obj))
# 
#         elif hasattr(obj, '__iter__'):
#             result.append('[\n')
#             indent += 1
#             for x in obj:
#                 result.append('\t' * indent)
#                 result.append(pretty_print(x, indent, max_depth))
#                 result.append(',\n')
#             indent -= 1
#             result.append('\t' * indent)
#             result.append(']')
# 
#         else:
#             result.append(repr(obj))
# 
#         return ''.join(result)


import base64
import json
import struct
import time
from datetime import datetime, date, timedelta, timezone
from .helpers import pretty_print

_EPOCH_NAIVE = datetime(*time.gmtime(0)[:6])
_EPOCH_NAIVE_LOCAL = datetime(*time.localtime(0)[:6])
_EPOCH = _EPOCH_NAIVE.replace(tzinfo=timezone.utc)


def _datetime_to_timestamp(dt):
    # If no timezone is specified, it is assumed to be in utc zone

# Path: telethon/_misc/helpers.py
# def pretty_print(obj, indent=None, max_depth=float('inf')):
#     max_depth -= 1
#     if max_depth < 0:
#         return '...'
# 
#     to_d = getattr(obj, 'to_dict', None)
#     if callable(to_d):
#         obj = to_d()
# 
#     if indent is None:
#         if isinstance(obj, dict):
#             return '{}({})'.format(obj.get('_', 'dict'), ', '.join(
#                 '{}={}'.format(k, pretty_print(v, indent, max_depth))
#                 for k, v in obj.items() if k != '_'
#             ))
#         elif isinstance(obj, str) or isinstance(obj, bytes):
#             return repr(obj)
#         elif hasattr(obj, '__iter__'):
#             return '[{}]'.format(
#                 ', '.join(pretty_print(x, indent, max_depth) for x in obj)
#             )
#         else:
#             return repr(obj)
#     else:
#         result = []
# 
#         if isinstance(obj, dict):
#             result.append(obj.get('_', 'dict'))
#             result.append('(')
#             if obj:
#                 result.append('\n')
#                 indent += 1
#                 for k, v in obj.items():
#                     if k == '_':
#                         continue
#                     result.append('\t' * indent)
#                     result.append(k)
#                     result.append('=')
#                     result.append(pretty_print(v, indent, max_depth))
#                     result.append(',\n')
#                 result.pop()  # last ',\n'
#                 indent -= 1
#                 result.append('\n')
#                 result.append('\t' * indent)
#             result.append(')')
# 
#         elif isinstance(obj, str) or isinstance(obj, bytes):
#             result.append(repr(obj))
# 
#         elif hasattr(obj, '__iter__'):
#             result.append('[\n')
#             indent += 1
#             for x in obj:
#                 result.append('\t' * indent)
#                 result.append(pretty_print(x, indent, max_depth))
#                 result.append(',\n')
#             indent -= 1
#             result.append('\t' * indent)
#             result.append(']')
# 
#         else:
#             result.append(repr(obj))
# 
#         return ''.join(result)


# Path: telethon/_misc/tlobject.py
import base64
import json
import struct
import time
from datetime import datetime, date, timedelta, timezone
from .helpers import pretty_print


_EPOCH_NAIVE = datetime(*time.gmtime(0)[:6])
_EPOCH_NAIVE_LOCAL = datetime(*time.localtime(0)[:6])
_EPOCH = _EPOCH_NAIVE.replace(tzinfo=timezone.utc)


def _datetime_to_timestamp(dt):
    # If no timezone is specified, it is assumed to be in utc zone

    if dt.tzinfo is None: