@pexdoc.pcontracts.new_contract()<EOL>def file_name(obj):
msg = pexdoc.pcontracts.get_exdesc()<EOL>if not isinstance(obj, str) or (isinstance(obj, str) and ("<STR_LIT>" in obj)):<EOL><INDENT>raise ValueError(msg)<EOL><DEDENT>try:<EOL><INDENT>if not os.path.exists(obj):<EOL><INDENT>os.access(obj, os.W_OK)<EOL><DEDENT><DEDENT>except (TypeError, ValueError):  <EOL><INDENT>raise ValueError(msg)<EOL><DEDENT>
r"""
    Validate if an object is a legal name for a file.

    :param obj: Object
    :type  obj: any

    :raises: RuntimeError (Argument \`*[argument_name]*\` is not
     valid). The token \*[argument_name]\* is replaced by the name
     of the argument the contract is attached to

    :rtype: None