'Call management command and return output'

def call_command(self, name, *args, **kwargs):

    out = StringIO()
    call_command(name, stdout=out, *args, **kwargs)
    out.seek(0)
    return out.read()
