<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def env_dictionary(self):
 """ convert the options to this script into an env var dictionary for pre and post scripts """

        none_to_str = lambda x: str(x) if x else ""
        return {"DOCKERSTACHE_{}".format(k.upper()): none_to_str(v) for k, v in six.iteritems(self)}