# Path: openaq/utils.py
# def to_naive_timestamp(timestamp):
#     """
#         Convert a timezone aware timestamp (as a string) and return the
#         python datetime in the local timezone, but without the tzinfo attribute
#     """
#     return dateutil.parser.parse(timestamp).replace(tzinfo=None).isoformat()
# 
# def clean_encodings(unit):
#     if unit not in ('ppm', 'ppb', 'ppt', 'ugm3'):
#         unit = unit.encode('utf-8')
# 
#         if unit == '\xc2\xb5g/m\xc2\xb3':
#             unit = 'ugm3'
# 
#     return unit


from functools import wraps
from unittest import SkipTest
from .utils import to_naive_timestamp, clean_encodings
import warnings
    import pandas as pd
                                d.append(tmp)

                            resp = d

                    data = pd.io.json.json_normalize(resp)

                    # If there are any datetimes, make them datetimes!
                    for each in [i for i in data.columns if 'date' in i]:
                        if 'local' in each:
                            data[each] = pd.to_datetime(data[each].apply(lambda x: to_naive_timestamp(x)))
                        else:
                            data[each] = pd.to_datetime(data[each])

                    if f.__name__ in ('latest'):
                        data.index = data['lastUpdated']

                        del data['lastUpdated']

                    elif f.__name__ in ('measurements'):
                        if index == 'utc':
                            data.index = data['date.utc']
                            del data['date.utc']
                        elif index == 'local':
                            data.index = data['date.local']
                            del data['date.local']
                        else:
                            pass

                    # Clean up encodings
                    if 'unit' in data.columns:

# Path: openaq/utils.py
# def to_naive_timestamp(timestamp):
#     """
#         Convert a timezone aware timestamp (as a string) and return the
#         python datetime in the local timezone, but without the tzinfo attribute
#     """
#     return dateutil.parser.parse(timestamp).replace(tzinfo=None).isoformat()
# 
# def clean_encodings(unit):
#     if unit not in ('ppm', 'ppb', 'ppt', 'ugm3'):
#         unit = unit.encode('utf-8')
# 
#         if unit == '\xc2\xb5g/m\xc2\xb3':
#             unit = 'ugm3'
# 
#     return unit


# Path: openaq/decorators.py
from functools import wraps
from unittest import SkipTest
from .utils import to_naive_timestamp, clean_encodings
import warnings
    import pandas as pd

                                d.append(tmp)

                            resp = d

                    data = pd.io.json.json_normalize(resp)

                    # If there are any datetimes, make them datetimes!
                    for each in [i for i in data.columns if 'date' in i]:
                        if 'local' in each:
                            data[each] = pd.to_datetime(data[each].apply(lambda x: to_naive_timestamp(x)))
                        else:
                            data[each] = pd.to_datetime(data[each])

                    if f.__name__ in ('latest'):
                        data.index = data['lastUpdated']

                        del data['lastUpdated']

                    elif f.__name__ in ('measurements'):
                        if index == 'utc':
                            data.index = data['date.utc']
                            del data['date.utc']
                        elif index == 'local':
                            data.index = data['date.local']
                            del data['date.local']
                        else:
                            pass

                    # Clean up encodings
                    if 'unit' in data.columns:

                        data['unit'] = data['unit'].apply(clean_encodings)