def _GetAliasForIdentifier(identifier, alias_map):
    """Returns the aliased_symbol name for an identifier.

    Example usage:
      >>> alias_map = {'MyClass': 'goog.foo.MyClass'}
      >>> _GetAliasForIdentifier('MyClass.prototype.action', alias_map)
      'goog.foo.MyClass.prototype.action'

      >>> _GetAliasForIdentifier('MyClass.prototype.action', {})
      None

    Args:
      identifier: The identifier.
      alias_map: A dictionary mapping a symbol to an alias.

    Returns:
      The aliased symbol name or None if not found.
    """
    ns = identifier.split('.', 1)[0]
    aliased_symbol = alias_map.get(ns)
    if aliased_symbol:
        return aliased_symbol + identifier[len(ns):]