def _generate_location(location, items, techs):
    """
    Returns a dict for a given location. Dict keys for permitted technologies
    are the only ones that don't start with '_'.

    Args:
        location : (str) name of the location
        items : (AttrDict) location settings
        techs : (list) list of available technologies
    """
    # Mandatory basics
    within = items.get('within', None)
    level = items.get('level', None)
    d = {'_location': location, '_level': level,
         '_within': str(within)}
    # Override
    if 'override' in items:
        for k in items.override.keys_nested():
            target_key = '_override.' + k
            try:
                d[target_key] = items.override.get_key(k)
            except KeyError:
                # Allow locations to not define 'within'
                if k == 'within':
                    d[target_key] = None
    # Permitted echnologies
    for y in techs:
        if y in items.techs:
            d[y] = 1
        else:
            d[y] = 0
    return d