<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove_unused_links(dirpath, required_links):
 """Recursively remove any links in dirpath which are not contained in required_links. :param str dirpath: Absolute path of directory to search. :param container required_links: Container of "in use" links which should not be removed, where each link is an absolute path. """

    for root, dirs, files in os.walk(dirpath):
      for p in chain(dirs, files):
        p = os.path.join(root, p)
        if os.path.islink(p) and p not in required_links:
          os.unlink(p)