'Return a VPC dictionary or the value of given key of.'

def get_vpc(self, key=None):

    if self.vpc:
        return self._get_by_key(key, self.vpc)
    vpc = self.module.params.get('vpc')
    if (not vpc):
        vpc = os.environ.get('CLOUDSTACK_VPC')
    if (not vpc):
        return None
    args = {'account': self.get_account(key='name'), 'domainid': self.get_domain(key='id'), 'projectid': self.get_project(key='id'), 'zoneid': self.get_zone(key='id')}
    vpcs = self.query_api('listVPCs', **args)
    if (not vpcs):
        self.fail_json(msg='No    VPCs    available.')
    for v in vpcs['vpc']:
        if (vpc in [v['name'], v['displaytext'], v['id']]):
            if self.vpc:
                self.fail_json(msg=("More    than    one    VPC    found    with    the    provided    identifyer    '%s'" % vpc))
            else:
                self.vpc = v
                self.result['vpc'] = v['name']
    if self.vpc:
        return self._get_by_key(key, self.vpc)
    self.fail_json(msg=("VPC    '%s'    not    found" % vpc))
