import re


def _escape_hallofbeorn_filename(value):
    """ Escape forbidden symbols in a Hall of Beorn file name.
    """
    value = re.sub(r'[.,!<>:\/\\|?*"“”„«»…¡¿]', '', str(value))
    value = (value.replace(' - ', '-').replace('’', "'").replace('_', '-')
             .replace('–', '-').replace('—', '-').replace('&', 'and'))
    value = value.strip()
    value = value.replace(' ', '-')
    value = re.sub(r'(png|jpg)$', '.\\1', value)
    return value