(resource)
return ''
Returns a name, or a code, or an empty string.
Returns a name, or a code, or an empty string.
Returns a name or a code or an empty string .
def get_name(resource):
    """
    Returns a name, or a code, or an empty string.
    """
    if resource.get('name'):
        return resource['name'][0].get('text', '')
    if resource.get('code'):
        return resource['code'][0].get('text', '')
    return ''
def get_name ( resource ) : if resource . get ( 'name' ) : return resource [ 'name' ] [ 0 ] . get ( 'text' , '' ) if resource . get ( 'code' ) : return resource [ 'code' ] [ 0 ] . get ( 'text' , '' ) return ''