def create_session(self, uid, duration=0):

        '''
            a method to create a session token for the user
            
        :param uid: string with id of user in bucket
        :param duration: integer with number of seconds to last (default: 24hrs) 
        :return: dictionary with account fields for user
        '''
    
        title = '%s.create_session' % self.__class__.__name__
        
    # validate inputs
        input_fields = {
            'uid': uid,
            'duration': duration
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)
        
    # construct request fields
        url = self.bucket_url + '/_session'
        json_data = {
            'name': uid
        }
        if duration:
            json_data['ttl'] = duration
    
    # send request and unwrap response
        response = requests.post(url, json=json_data)
        response = response.json()
    
        return response