def format_string(stringwithmarkup):
    """
	Convert a PubChem formatted string into an HTML formatted string
	"""
    string = list(stringwithmarkup['String'])
    try:
        markup_list = stringwithmarkup['Markup']
    except KeyError:
        markup_list = []
    for markup in markup_list:
        style = None
        start = markup['Start']
        end = markup['Length'] + start - 1
        if markup['Type'] == 'Italics':
            style = 'i'
        if style is None:
            print(markup)
            continue
        string[start] = f'<{style}>{string[start]}'
        string[end] = f'{string[end]}</{style}>'
    string = ''.join(string)
    return string
