def prefix_with_ns_if_necessary(name, name_ns, source_ns):
    # type: (typing.Text, ApiNamespace, ApiNamespace) -> typing.Text
    """
    Returns a name that can be used to reference `name` in namespace `name_ns`
    from `source_ns`.

    If `source_ns` and `name_ns` are the same, that's just `name`. Otherwise
    it's `name_ns`.`name`.
    """
    if source_ns == name_ns:
        return name
    return '{}.{}'.format(fmt_namespace(name_ns.name), name)
def prefix_with_ns_if_necessary ( name , name_ns , source_ns ) : if source_ns == name_ns : return name return '{}.{}' . format ( fmt_namespace ( name_ns . name ) , name )
Returns a name that can be used to reference `name` in namespace `name_ns`
    from `source_ns`.

    If `source_ns` and `name_ns` are the same, that's just `name`. Otherwise
    it's `name_ns`.`name`.