def rpc_get_DID_record(self, did, **con_info):
        """
        Given a DID, return the name or subdomain it corresponds to
        """
        if not isinstance(did, (str,unicode)):
            return {'error': 'Invalid DID: not a string', 'http_status': 400}

        try:
            did_info = parse_DID(did)
        except:
            return {'error': 'Invalid DID', 'http_status': 400}

        res = None
        if did_info['name_type'] == 'name':
            res = self.get_name_DID_record(did)
        elif did_info['name_type'] == 'subdomain':
            res = self.get_subdomain_DID_record(did)
        
        if 'error' in res:
            return {'error': res['error'], 'http_status': res.get('http_status', 404)}

        return self.success_response({'record': res['record']})
def rpc_get_DID_record ( self , did , ** con_info ) : if not isinstance ( did , ( str , unicode ) ) : return { 'error' : 'Invalid DID: not a string' , 'http_status' : 400 } try : did_info = parse_DID ( did ) except : return { 'error' : 'Invalid DID' , 'http_status' : 400 } res = None if did_info [ 'name_type' ] == 'name' : res = self . get_name_DID_record ( did ) elif did_info [ 'name_type' ] == 'subdomain' : res = self . get_subdomain_DID_record ( did ) if 'error' in res : return { 'error' : res [ 'error' ] , 'http_status' : res . get ( 'http_status' , 404 ) } return self . success_response ( { 'record' : res [ 'record' ] } )
Given a DID, return the name or subdomain it corresponds to