'Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any
existing ``RECORD`` file is silently overwritten.
prefix is used to determine when to write absolute paths.'

def write_installed_files(self, paths, prefix, dry_run=False):

    prefix = os.path.join(prefix, u'')
    base = os.path.dirname(self.path)
    base_under_prefix = base.startswith(prefix)
    base = os.path.join(base, u'')
    record_path = self.get_distinfo_file(u'RECORD')
    logger.info(u'creating    %s', record_path)
    if dry_run:
        return None
    with CSVWriter(record_path) as writer:
        for path in paths:
            if (os.path.isdir(path) or path.endswith((u'.pyc', u'.pyo'))):
                hash_value = size = u''
            else:
                size = (u'%d' % os.path.getsize(path))
                with open(path, u'rb') as fp:
                    hash_value = self.get_hash(fp.read())
            if (path.startswith(base) or (base_under_prefix and path.startswith(prefix))):
                path = os.path.relpath(path, base)
            writer.writerow((path, hash_value, size))
        if record_path.startswith(base):
            record_path = os.path.relpath(record_path, base)
        writer.writerow((record_path, u'', u''))
    return record_path
