def parse_dimensions(tag, tag_json, dimension_keys=('width', 'height')):
    """
    Adds dimensions to converted JSON. Images and iframes will generally
    have width/height properties; this is just a convenience method for
    adding those properties.
    """
    for dimension_key in dimension_keys:
        try:
            tag_json[dimension_key] = int(tag.attrs.get(dimension_key))
        except Exception:
            pass
