import re


def add_mapping(token, map_num=1):
    """Add a given tag (atom mapping) into a SMILES token"""
    if not re.match('.*[a-zA-Z].*', token):
        return token
    if token[0] == '[':
        if re.match('\[.*:[1-9]+\]', token):
            result = token
        else:
            result = token.replace(']', ':{}]'.format(map_num))
    else:
        result = '[{}:{}]'.format(token, map_num)
    return result