You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: avatars_helper.rb
    path of file: ./repos/gitlabhq/app/helpers
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module AvatarsHelper
  DEFAULT_AVATAR_PATH = 'no_avatar.png'

  def g
    
  def avatar_icon_by_user_email_or_gravatar(email, size, scale, only_path:, by_commit_email: false)
    user =
      if by_commit_email
        User.find_by_any_email(email)
      else
        User.with_public_email(email).first
      end