code: def get_name(tags_or_instance_or_id):
    
  
    ec2 = get_ec2_resource()
    if hasattr(tags_or_instance_or_id, 'tags'):
      tags = tags_or_instance_or_id.tags
    elif isinstance(tags_or_instance_or_id, str):
      tags = ec2.Instance(tags_or_instance_or_id).tags
    elif tags_or_instance_or_id is None:
      return EMPTY_NAME
    else:
      assert isinstance(tags_or_instance_or_id,
                        Iterable), "expected iterable of tags"
      tags = tags_or_instance_or_id
  
    if not tags:
      return EMPTY_NAME
    names = [entry['Value'] for entry in tags if entry['Key'] == 'Name']
    if not names:
      return ''
    if len(names) > 1:
      assert False, "have more than one name: " + str(names)
    return names[0]
docs: Helper utility to extract name out of tags dictionary or intancce.
        [{'Key': 'Name', 'Value': 'nexus'}] -> 'nexus'
   
       Assert fails if there's more than one name.
       Returns '' if there's less than one name.