<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def config_dir(mkcustom=False):
 """Returns the configuration directory for custom package settings. """

    from acorn.utility import reporoot
    from acorn.base import testmode
    from os import path
    alternate = path.join(path.abspath(path.expanduser("~")), ".acorn")
    if testmode or (not path.isdir(alternate) and not mkcustom):
        return path.join(reporoot, "acorn", "config")
    else:
        if mkcustom:# pragma: no cover
            #This never gets reached when we are in testmode because we don't
            #want to clobber the user's local config cache.
            from os import mkdir
            mkdir(alternate)
        return alternate