<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def get_networks(parent_ref, network_names=None, get_all_networks=False):
    '''
    Returns networks of standard switches.
    The parent object can be a datacenter.

    parent_ref
        The parent object reference. A datacenter object.

    network_names
        The name of the standard switch networks. Default is None.

    get_all_networks
        Boolean indicates whether to return all networks in the parent.
        Default is False.
    '''

    if not isinstance(parent_ref, vim.Datacenter):
        raise salt.exceptions.ArgumentValueError(
            'Parent has to be a datacenter.')
    parent_name = get_managed_object_name(parent_ref)
    log.trace('Retrieving network from %s \'%s\', network_names=\'%s\', '
              'get_all_networks=%s',
              type(parent_ref).__name__,
              parent_name,
              ','.join(network_names) if network_names else None,
              get_all_networks)
    properties = ['name']
    service_instance = get_service_instance_from_managed_object(parent_ref)
    traversal_spec = vmodl.query.PropertyCollector.TraversalSpec(
        path='networkFolder',
        skip=True,
        type=vim.Datacenter,
        selectSet=[vmodl.query.PropertyCollector.TraversalSpec(
            path='childEntity',
            skip=False,
            type=vim.Folder)])
    items = [i['object'] for i in
             get_mors_with_properties(service_instance,
                                      vim.Network,
                                      container_ref=parent_ref,
                                      property_list=properties,
                                      traversal_spec=traversal_spec)
             if get_all_networks or
             (network_names and i['name'] in network_names)]
    return items