a helper method for other storage clients to import into appdata
            
        :param record_key: string with key for record
        :param record_data: byte data for body of record
        :param overwrite: [optional] boolean to overwrite existing records
        :param last_modified: [optional] float to record last modified date
        :param kwargs: [optional] keyword arguments from other import methods 
        :return: boolean indicating whether record was imported

def _import(self, record_key, record_data, overwrite=True, last_modified=0.0, **kwargs):
        
        '''
            a helper method for other storage clients to import into appdata
            
        :param record_key: string with key for record
        :param record_data: byte data for body of record
        :param overwrite: [optional] boolean to overwrite existing records
        :param last_modified: [optional] float to record last modified date
        :param kwargs: [optional] keyword arguments from other import methods 
        :return: boolean indicating whether record was imported
        '''
        
        title = '%s._import' % self.__class__.__name__
    
    # verify permissions
        if not self.permissions_write:
            raise Exception('%s requires an access_token with write permissions.' % title)
    
    # retrieve file id
        file_id, parent_id = self._get_id(record_key)
        
    # check overwrite condition
        if file_id:
            if overwrite:
                try:
                    self.drive.delete(fileId=file_id).execute()
                except:
                    raise DriveConnectionError(title)
            else:
                return False
    
    # # check size of file
    #     import sys
    #     record_optimal = self.fields.metadata['record_optimal_bytes']
    #     record_size = sys.getsizeof(record_data)
    #     error_prefix = '%s(record_key="%s", record_data=b"...")' % (title, record_key)
    #     if record_size > record_optimal:
    #         print('[WARNING] %s exceeds optimal record data size of %s bytes.' % (error_prefix, record_optimal))
            
    # prepare file body
        from googleapiclient.http import MediaInMemoryUpload
        media_body = MediaInMemoryUpload(body=record_data, resumable=True)
        
    # determine path segments
        path_segments = record_key.split(os.sep)
        
    # construct upload kwargs
        create_kwargs = {
            'body': {
                'name': path_segments.pop()
            },
            'media_body': media_body,
            'fields': 'id'
        }
    
    # walk through parent directories
        parent_id = ''
        if path_segments:
        
        # construct query and creation arguments
            walk_folders = True
            folder_kwargs = {
                'body': {
                    'name': '',
                    'mimeType' : 'application/vnd.google-apps.folder'
                },
                'fields': 'id'
            }
            query_kwargs = {
                'spaces': self.drive_space,
                'fields': 'files(id, parents)'
            }
            while path_segments:
                folder_name = path_segments.pop(0)
                folder_kwargs['body']['name'] = folder_name
        
        # search for folder id in existing hierarchy
                if walk_folders:
                    walk_query = "name = '%s'" % folder_name
                    if parent_id:
                        walk_query += "and '%s' in parents" % parent_id
                    query_kwargs['q'] = walk_query
                    try:
                        response = self.drive.list(**query_kwargs).execute()
                    except:
                        raise DriveConnectionError(title)
                    file_list = response.get('files', [])
                else:
                    file_list = []
                if file_list:
                    parent_id = file_list[0].get('id')
        
        # or create folder
        # https://developers.google.com/drive/v3/web/folder
                else:
                    try:
                        if not parent_id:
                            if self.drive_space == 'appDataFolder':
                                folder_kwargs['body']['parents'] = [ self.drive_space ]
                            else:
                                del folder_kwargs['body']['parents']
                        else:
                            folder_kwargs['body']['parents'] = [parent_id]
                        response = self.drive.create(**folder_kwargs).execute()
                        parent_id = response.get('id')
                        walk_folders = False
                    except:
                        raise DriveConnectionError(title)
    
    # add parent id to file creation kwargs
        if parent_id:
            create_kwargs['body']['parents'] = [parent_id]
        elif self.drive_space == 'appDataFolder':
            create_kwargs['body']['parents'] = [self.drive_space] 
    
    # modify file time
        import re
        if re.search('\\.drep$', create_kwargs['body']['name']):
            from labpack.records.time import labDT
            drep_time = labDT.fromEpoch(1).isoformat()
            create_kwargs['body']['modifiedTime'] = drep_time
        elif last_modified:
            from labpack.records.time import labDT
            mod_time = labDT.fromEpoch(last_modified).isoformat()
            create_kwargs['body']['modifiedTime'] = mod_time
            
    # send create request
        try:
            self.drive.create(**create_kwargs).execute()
        except:
            raise DriveConnectionError(title)
        
        return True