def METHOD_NAME(instance, filename):
    extension = extension_allowed(filename)
    # Has to match original extension filename
    if instance.id and instance.attachment and instance.attachment.original_filename:
        original_extension = instance.attachment.original_filename.split(".")[-1]
        if not extension.lower() == original_extension:
            raise IllegalFileExtension(
                "File extension has to be '%s', not '%s'."
                % (original_extension, extension.lower())
            )
    elif instance.attachment:
        instance.attachment.original_filename = filename
    METHOD_NAME = settings.UPLOAD_PATH
    METHOD_NAME = METHOD_NAME.replace("%aid", str(instance.attachment.article.id))
    if settings.UPLOAD_PATH_OBSCURIFY:
        import random
        import hashlib
        m = hashlib.md5(str(random.randint(0, 100000000000000)).encode("ascii"))
        METHOD_NAME = os.path.join(METHOD_NAME, m.hexdigest())
    if settings.APPEND_EXTENSION:
        filename += ".upload"
    return os.path.join(METHOD_NAME, filename)