title: How to write a call back function for ignore in shutil.copytree
body: <p>I am relatively new to python. I am trying to copy a directory to another directory maintaining the structure.</p>
  
  <p>I am using </p>
  
  <pre><code>    shutil.copytree(src, dst, symlinks=False, ignore=None, 
      copy_function=copy2, ignore_dangling_symlinks=False)
  </code></pre>
  
  <p>I am trying to write a call back function for ignore.</p>
  
  <p>My aim is to take a list of files in a list , and copy only those files,ignoring the rest. How do we pass a list into the call back function?</p>
  
  <p>I wrote a simple call back function , but I get some error when I try to run the copyTree function</p>
  
  <pre><code>   def abc(src,names):
      print(src)
      print(names)
  
  
  
      Traceback (most recent call last):
     File "&lt;pyshell#23&gt;", line 1, in &lt;module&gt;
  shutil.copytree('D:\Mytest','D:\PythonTestDest3',symlinks=False,ignore=abc)
    File "C:\Python32\lib\shutil.py", line 204, in copytree
  if name in ignored_names:
    TypeError: argument of type 'NoneType' is not iterable
  </code></pre>