def valid_filename(value):
    """ Validate that the string passed as input can safely be used as a valid file name """
    if value in ['.', '..']:
        raise Exception('Invalid name: %s' % value)
    bad_chars = '<>:"/\\|?*'
    for bad_char in bad_chars:
        if bad_char in value:
            mess = "Invalid name: '%s'\n" % value
            mess += 'A valid name should not contain any '
            mess += 'of the following chars:\n'
            mess += ' '.join(bad_chars)
            raise Exception(mess)
    return value
