def html_box(item):
    """Returns an HTML block with template strings filled-in based on item attributes."""
    is_layer = str(type(item)) == "<class 'Skydipper.layer.Layer'>"
    is_dataset = str(type(item)) == "<class 'Skydipper.dataset.Dataset'>"
    is_widget = str(type(item)) == "<class 'Skydipper.Skydipper.Widget'>"
    is_geometry = str(type(item)) == "<class 'Skydipper.geometry.Geometry'>"
    is_image = str(type(item)) == "<class 'Skydipper.image.Image'>"
    site_link = "<a href='https://skydipper.com/' target='_blank'>"
    site_logo = (
        "<img class='itemThumbnail' src='https://skydipper.com/images/logo.png'>"
        )
    if is_layer:
        kind_of_item = 'Layer'
        url_link = f'{item.server}/v1/layer/{item.id}?includes=metadata'
    elif is_dataset:
        kind_of_item = 'Dataset'
        url_link = (
            f'{item.server}/v1/dataset/{item.id}?includes=metadata,layer')
    elif is_image:
        if item.type in ['Classified Image', 'Composite Image']:
            instrument = item.type
        else:
            instrument = item.instrument
        html_string = (
            f"<div class='item_container' style='height: auto; overflow: hidden; border: 1px solid #2BA4A0;border-radius: 5px; background: #2BA4A0; line-height: 1.21429em; padding: 10px;''><div class='item_left' style='width: 100px; height: 100px; float: left;''><a href='{item.thumb_url}' target='_blank'><img class='itemThumbnail' src='{item.thumb_url}'></a></div><div class='item_right' style='float: none; width: auto; hidden;padding-left: 10px; overflow: hidden;''><b>Image Source</b>: {instrument} </br><b>Datetime</b>: {item.date_time} </br><b>Cloud score </b>: {item.cloud_score} </br> </div> </div>"
            )
        return html_string
    elif is_geometry:
        kind_of_item = 'Geometry'
        url_link = f'{item.server}/v1/geostore/{item.id}'
        html_string = (
            f"<div class='item_container' style='height: auto; overflow: hidden; border: 1px solid #2bA4A0;border-radius: 5px; background: #2bA4A0; line-height: 1.21429em; padding: 10px;''><div class='item_left' style='width: 210px; float: left;''>{site_link}{site_logo}</a></div><div class='item_right' style='float: none; width: auto; hidden;padding-left: 10px; overflow: hidden;''><b>Geometry id</b>: <a href={url_link} target='_blank'>{item.id}</a></br>"
            )
        for k, v in item.attributes.get('info').items():
            if v and k != 'simplifyThresh':
                html_string += f'<br><i>{k}: {v}</i>'
        html_string += ' </div> </div>'
        return html_string
    else:
        kind_of_item = 'Unknown'
        url_link = None
    table_statement = f"Data source {item.attributes.get('provider')}"
    if item.attributes.get('connectorUrl') and item.attributes.get('provider'
        ) == 'cartodb':
        table_statement = (
            f"Carto table: <a href={item.attributes.get('connectorUrl')} target='_blank'>{item.attributes.get('tableName')}</a>"
            )
    if item.attributes.get('provider') == 'gee':
        table_statement = (
            f"GEE asset: <a href='https://code.earthengine.google.com/asset='{item.attributes.get('tableName')} target='_blank'>{item.attributes.get('tableName')}</a>"
            )
    html = (
        f"<div class='item_container' style='height: auto; overflow: hidden; border: 1px solid #2BA4A0;border-radius: 2px; background: #2BA4A0; line-height: 1.21429em; padding: 10px;''><div class='item_left' style='width: 210px; float: left;''>{site_link}{site_logo}</a></div><div class='item_right' style='float: none; width: auto; hidden;padding-left: 10px; overflow: hidden;''><a href={url_link} target='_blank'><b>{item.attributes.get('name')}</b></a><br> {table_statement} | {kind_of_item} in {', '.join(item.attributes.get('application')).upper()}.<br>Last Modified: {item.attributes.get('updatedAt')}<br><a href='{item.server}/v1/fields/{item.id}' target='_blank'>Fields</a> Connector: {item.attributes.get('provider')} | Published: {item.attributes.get('published')} </div> </div>"
        )
    return html
