# Path: mapbox/errors.py
# class ValidationError(ValueError):
#     pass
# 
# class InvalidZoomError(ValidationError):
#     pass
# 
# class InvalidColumnError(ValidationError):
#     pass
# 
# class InvalidRowError(ValidationError):
#     pass
# 
# class InvalidFileFormatError(ValidationError):
#     pass
# 
# class InvalidPeriodError(ValidationError):
#     pass
# 
# class InvalidFeatureFormatError(ValidationError):
#     pass
# 
# class InvalidMarkerNameError(ValidationError):
#     pass
# 
# class InvalidLabelError(ValidationError):
#     pass
# 
# class InvalidColorError(ValidationError):
#     pass
# 
# Path: mapbox/services/base.py
# class Service(object):
#     """Service base class
# 
#     Attributes
#     ----------
#     default_host : str
#         Default service hostname: api.mapbox.com.
#     api_name : str
#         Mapbox API name.
#     api_version : str
#         API version string such as "v1" or "v5".
#     baseuri
#     username
# 
#     Methods
#     -------
#     handle_http_errors(response, custom_messages=None, raise_for_status=False)
#         Converts service errors to Python exceptions.
#     """
# 
#     default_host = 'api.mapbox.com'
#     api_name = 'hors service'
#     api_version = 'v0'
# 
#     def __init__(self, access_token=None, host=None, cache=None):
#         """Constructs a Service object
# 
#         This method should be overridden by subclasses.
# 
#         Parameters
#         ----------
#         access_token : str
#             Mapbox access token string.
#         host : str, optional
#             Mapbox API host (advanced usage only).
#         cache : CacheControl cache instance (Dict or FileCache), optional
#             Optional caching, not generally needed.
# 
#         Returns
#         -------
#         Service
#         """
#         self.session = Session(access_token)
#         self.host = host or os.environ.get('MAPBOX_HOST', self.default_host)
#         if cache:
#             self.session = CacheControl(self.session, cache=cache)
# 
#     @property
#     def baseuri(self):
#         """The service's base URI
# 
#         Returns
#         -------
#         str
#         """
#         return 'https://{0}/{1}/{2}'.format(
#             self.host, self.api_name, self.api_version)
# 
#     @property
#     def username(self):
#         """The username in the service's access token
# 
#         Returns
#         -------
#         str
#         """
#         token = self.session.params.get('access_token')
#         if not token:
#             raise errors.TokenError(
#                 "session does not have a valid access_token param")
#         data = token.split('.')[1]
#         # replace url chars and add padding
#         # (https://gist.github.com/perrygeo/ee7c65bb1541ff6ac770)
#         data = data.replace('-', '+').replace('_', '/') + "==="
#         try:
#             return json.loads(base64.b64decode(data).decode('utf-8'))['u']
#         except (ValueError, KeyError):
#             raise errors.TokenError(
#                 "access_token does not contain username")
# 
#     def handle_http_error(self, response, custom_messages=None,
#                           raise_for_status=False):
#         """Converts service errors to Python exceptions
# 
#         Parameters
#         ----------
#         response : requests.Response
#             A service response.
#         custom_messages : dict, optional
#             A mapping of custom exception messages to HTTP status codes.
#         raise_for_status : bool, optional
#             If True, the requests library provides Python exceptions.
# 
#         Returns
#         -------
#         None
#         """
#         if not custom_messages:
#             custom_messages = {}
#         if response.status_code in custom_messages.keys():
#             raise errors.HTTPError(custom_messages[response.status_code])
#         if raise_for_status:
#             response.raise_for_status()


from re import (
    compile,
    match
)
from mapbox.errors import (
    ValidationError,
    InvalidZoomError,
    InvalidColumnError,
    InvalidRowError,
    InvalidFileFormatError,
    InvalidPeriodError,
    InvalidFeatureFormatError,
    InvalidMarkerNameError,
    InvalidLabelError,
    InvalidColorError
)
from mapbox.services.base import Service
from dateutil.parser import parse
from uritemplate import URITemplate
            The tile's scale, where True indicates Retina scale
            (double scale) and False indicates regular scale.  

            The default value is false.
       
        file_format : str, optional
            The tile's file format.  

            The default value is png.

        style_id : str, optional
            The tile's style id.  

            style_id must be used together with timestamp.

        timestamp : str, optional
            The style id's ISO-formatted timestamp, found by 
            accessing the "modified" property of a style object.

            timestamp must be used together with style_id.

        Returns
        -------
        request.Response
            The response object with a tile in the specified format.
        """

        # Check x, y, and z.

        if x is None or y is None or z is None:

# Path: mapbox/errors.py
# class ValidationError(ValueError):
#     pass
# 
# class InvalidZoomError(ValidationError):
#     pass
# 
# class InvalidColumnError(ValidationError):
#     pass
# 
# class InvalidRowError(ValidationError):
#     pass
# 
# class InvalidFileFormatError(ValidationError):
#     pass
# 
# class InvalidPeriodError(ValidationError):
#     pass
# 
# class InvalidFeatureFormatError(ValidationError):
#     pass
# 
# class InvalidMarkerNameError(ValidationError):
#     pass
# 
# class InvalidLabelError(ValidationError):
#     pass
# 
# class InvalidColorError(ValidationError):
#     pass
# 
# Path: mapbox/services/base.py
# class Service(object):
#     """Service base class
# 
#     Attributes
#     ----------
#     default_host : str
#         Default service hostname: api.mapbox.com.
#     api_name : str
#         Mapbox API name.
#     api_version : str
#         API version string such as "v1" or "v5".
#     baseuri
#     username
# 
#     Methods
#     -------
#     handle_http_errors(response, custom_messages=None, raise_for_status=False)
#         Converts service errors to Python exceptions.
#     """
# 
#     default_host = 'api.mapbox.com'
#     api_name = 'hors service'
#     api_version = 'v0'
# 
#     def __init__(self, access_token=None, host=None, cache=None):
#         """Constructs a Service object
# 
#         This method should be overridden by subclasses.
# 
#         Parameters
#         ----------
#         access_token : str
#             Mapbox access token string.
#         host : str, optional
#             Mapbox API host (advanced usage only).
#         cache : CacheControl cache instance (Dict or FileCache), optional
#             Optional caching, not generally needed.
# 
#         Returns
#         -------
#         Service
#         """
#         self.session = Session(access_token)
#         self.host = host or os.environ.get('MAPBOX_HOST', self.default_host)
#         if cache:
#             self.session = CacheControl(self.session, cache=cache)
# 
#     @property
#     def baseuri(self):
#         """The service's base URI
# 
#         Returns
#         -------
#         str
#         """
#         return 'https://{0}/{1}/{2}'.format(
#             self.host, self.api_name, self.api_version)
# 
#     @property
#     def username(self):
#         """The username in the service's access token
# 
#         Returns
#         -------
#         str
#         """
#         token = self.session.params.get('access_token')
#         if not token:
#             raise errors.TokenError(
#                 "session does not have a valid access_token param")
#         data = token.split('.')[1]
#         # replace url chars and add padding
#         # (https://gist.github.com/perrygeo/ee7c65bb1541ff6ac770)
#         data = data.replace('-', '+').replace('_', '/') + "==="
#         try:
#             return json.loads(base64.b64decode(data).decode('utf-8'))['u']
#         except (ValueError, KeyError):
#             raise errors.TokenError(
#                 "access_token does not contain username")
# 
#     def handle_http_error(self, response, custom_messages=None,
#                           raise_for_status=False):
#         """Converts service errors to Python exceptions
# 
#         Parameters
#         ----------
#         response : requests.Response
#             A service response.
#         custom_messages : dict, optional
#             A mapping of custom exception messages to HTTP status codes.
#         raise_for_status : bool, optional
#             If True, the requests library provides Python exceptions.
# 
#         Returns
#         -------
#         None
#         """
#         if not custom_messages:
#             custom_messages = {}
#         if response.status_code in custom_messages.keys():
#             raise errors.HTTPError(custom_messages[response.status_code])
#         if raise_for_status:
#             response.raise_for_status()


# Path: mapbox/services/maps.py
from re import (
    compile,
    match
)
from mapbox.errors import (
    ValidationError,
    InvalidZoomError,
    InvalidColumnError,
    InvalidRowError,
    InvalidFileFormatError,
    InvalidPeriodError,
    InvalidFeatureFormatError,
    InvalidMarkerNameError,
    InvalidLabelError,
    InvalidColorError
)
from mapbox.services.base import Service
from dateutil.parser import parse
from uritemplate import URITemplate

            The tile's scale, where True indicates Retina scale
            (double scale) and False indicates regular scale.  

            The default value is false.
       
        file_format : str, optional
            The tile's file format.  

            The default value is png.

        style_id : str, optional
            The tile's style id.  

            style_id must be used together with timestamp.

        timestamp : str, optional
            The style id's ISO-formatted timestamp, found by 
            accessing the "modified" property of a style object.

            timestamp must be used together with style_id.

        Returns
        -------
        request.Response
            The response object with a tile in the specified format.
        """

        # Check x, y, and z.

        if x is None or y is None or z is None:

            raise ValidationError(