<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_source_description( self, capability_lists=None, outfile=None, links=None):
 """Write a ResourceSync Description document to outfile or STDOUT."""

        rsd = SourceDescription(ln=links)
        rsd.pretty_xml = self.pretty_xml
        if (capability_lists is not None):
            for uri in capability_lists:
                rsd.add_capability_list(uri)
        if (outfile is None):
            print(rsd.as_xml())
        else:
            rsd.write(basename=outfile)