def loadAliasFile(domains, filename=None, fp=None):
 result = {}
 close = False
 if (fp is None):
  fp = open(filename)
  close = True
 else:
  filename = getattr(fp, 'name', '<unknown>')
 i = 0
 prev = ''
 try:
  for line in fp:
   i += 1
   line = line.rstrip()
   if line.lstrip().startswith('#'):
    continue
   elif (line.startswith(' ') or line.startswith(' DCTB ')):
    prev = (prev + line)
   else:
    if prev:
     handle(result, prev, filename, i)
    prev = line
 finally:
  if close:
   fp.close()
 if prev:
  handle(result, prev, filename, i)
 for (u, a) in result.items():
  result[u] = AliasGroup(a, domains, u)
 return result

def loadAliasFile ( domains , filename = None , fp = None ) : result = { } close = False if ( fp is None ) : fp = open ( filename ) close = True else : filename = getattr ( fp , 'name' , '<unknown>' ) i = 0 prev = '' try : for line in fp : i += 1 line = line . rstrip ( ) if line . lstrip ( ) . startswith ( '#' ) : continue elif ( line . startswith ( ' ' ) or line . startswith ( ' DCTB ' ) ) : prev = ( prev + line ) else : if prev : handle ( result , prev , filename , i ) prev = line finally : if close : fp . close ( ) if prev : handle ( result , prev , filename , i ) for ( u , a ) in result . items ( ) : result [ u ] = AliasGroup ( a , domains , u ) return result
load a file containing email aliases .