<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_executable_script(filepath, body, program=None):
 """Create an executable script. Args: filepath (str):
 File to create. body (str or callable):
 Contents of the script. If a callable, its code is used as the script body. program (str):
 Name of program to launch the script, 'python' if None """

    program = program or "python"
    if callable(body):
        from rez.utils.sourcecode import SourceCode
        code = SourceCode(func=body)
        body = code.source

    if not body.endswith('\n'):
        body += '\n'

    with open(filepath, 'w') as f:
        # TODO: make cross platform
        f.write("#!/usr/bin/env %s\n" % program)
        f.write(body)

    # TODO: Although Windows supports os.chmod you can only set the readonly
    # flag. Setting the file readonly breaks the unit tests that expect to
    # clean up the files once the test has run.  Temporarily we don't bother
    # setting the permissions, but this will need to change.
    if os.name == "posix":
    	os.chmod(filepath, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
             | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)