import re


def identifier(filename):
    """
    File names are of the format: 09.44.32 hrs __[0000312].jpeg and we need
    to filter out the 0000312 part to use as identifier
    """
    match = re.search('\[(\d+)\]', filename)
    if match:
        return 'attachment' + match.group(1)
    else:
        # if we can't match, lets hope returning the filename works
        return filename